Revert of Replace SkTypeface::Style with SkFontStyle. (patchset #9 id:160001 of https://codereview.chromium.org/488143002/)

Reason for revert:
CrOS GM failures:

[*] 2 ExpectationsMismatch: fontmgr_iter_565.png fontmgr_iter_8888.png

Original issue's description:
> Replace SkTypeface::Style with SkFontStyle.
>
> Committed: https://skia.googlesource.com/skia/+/43b8b36b20ae00e2d78421c4cda1f3f922983a20

TBR=reed@google.com,bungeman@google.com
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/667023002
diff --git a/gyp/core.gypi b/gyp/core.gypi
index 4f9379f..5e81116 100644
--- a/gyp/core.gypi
+++ b/gyp/core.gypi
@@ -248,7 +248,6 @@
         '<(skia_include_path)/core/SkFloatBits.h',
         '<(skia_include_path)/core/SkFloatingPoint.h',
         '<(skia_include_path)/core/SkFontHost.h',
-        '<(skia_include_path)/core/SkFontStyle.h',
         '<(skia_include_path)/core/SkGraphics.h',
         '<(skia_include_path)/core/SkImage.h',
         '<(skia_include_path)/core/SkImageDecoder.h',
diff --git a/gyp/ports.gyp b/gyp/ports.gyp
index 78d59df..268f6fd 100644
--- a/gyp/ports.gyp
+++ b/gyp/ports.gyp
@@ -60,6 +60,7 @@
         '../include/ports/SkFontConfigInterface.h',
         '../include/ports/SkFontMgr.h',
         '../include/ports/SkFontMgr_indirect.h',
+        '../include/ports/SkFontStyle.h',
         '../include/ports/SkRemotableFontMgr.h',
       ],
       'conditions': [
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index f7af5d2..a080d84 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -11,7 +11,6 @@
 #define SkTypeface_DEFINED
 
 #include "SkAdvancedTypefaceMetrics.h"
-#include "SkFontStyle.h"
 #include "SkWeakRefCnt.h"
 
 class SkDescriptor;
@@ -50,25 +49,17 @@
         kBoldItalic = 0x03
     };
 
-    /** Returns the typeface's intrinsic style attributes. */
-    SkFontStyle fontStyle() const {
-        return fStyle;
-    }
+    /** Returns the typeface's intrinsic style attributes
+    */
+    Style style() const { return fStyle; }
 
-    /** Returns the typeface's intrinsic style attributes. 
-     *  @deprecated use fontStyle() instead.
-     */
-    Style style() const {
-        return static_cast<Style>(
-            (fStyle.weight() >= SkFontStyle::kSemiBold_Weight ? kBold : kNormal) |
-            (fStyle.slant()  != SkFontStyle::kUpright_Slant ? kItalic : kNormal));
-    }
+    /** Returns true if getStyle() has the kBold bit set.
+    */
+    bool isBold() const { return (fStyle & kBold) != 0; }
 
-    /** Returns true if style() has the kBold bit set. */
-    bool isBold() const { return fStyle.weight() >= SkFontStyle::kSemiBold_Weight; }
-
-    /** Returns true if style() has the kItalic bit set. */
-    bool isItalic() const { return fStyle.slant() != SkFontStyle::kUpright_Slant; }
+    /** Returns true if getStyle() has the kItalic bit set.
+    */
+    bool isItalic() const { return (fStyle & kItalic) != 0; }
 
     /** Returns true if the typeface claims to be fixed-pitch.
      *  This is a style bit, advance widths may vary even if this returns true.
@@ -294,7 +285,7 @@
 protected:
     /** uniqueID must be unique and non-zero
     */
-    SkTypeface(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch = false);
+    SkTypeface(Style style, SkFontID uniqueID, bool isFixedPitch = false);
     virtual ~SkTypeface();
 
     /** Sets the fixedPitch bit. If used, must be called in the constructor. */
@@ -360,7 +351,7 @@
     static void        DeleteDefault(SkTypeface*);
 
     SkFontID    fUniqueID;
-    SkFontStyle fStyle;
+    Style       fStyle;
     bool        fIsFixedPitch;
 
     friend class SkPaint;
diff --git a/include/core/SkFontStyle.h b/include/ports/SkFontStyle.h
similarity index 92%
rename from include/core/SkFontStyle.h
rename to include/ports/SkFontStyle.h
index f42d7dd..9d9a912 100644
--- a/include/core/SkFontStyle.h
+++ b/include/ports/SkFontStyle.h
@@ -43,8 +43,6 @@
 
     SkFontStyle();
     SkFontStyle(int weight, int width, Slant);
-    /** oldStyle means the style-bits in SkTypeface::Style: bold=1, italic=2 */
-    explicit SkFontStyle(unsigned oldStyle);
 
     bool operator==(const SkFontStyle& rhs) const {
         return fUnion.fU32 == rhs.fUnion.fU32;
diff --git a/src/core/SkFontHost.cpp b/src/core/SkFontHost.cpp
index 77b80e8..ce73491 100644
--- a/src/core/SkFontHost.cpp
+++ b/src/core/SkFontHost.cpp
@@ -67,15 +67,6 @@
     fUnion.fR.fSlant = SkPin32(slant, kUpright_Slant, kItalic_Slant);
 }
 
-SkFontStyle::SkFontStyle(unsigned oldStyle) {
-    fUnion.fU32 = 0;
-    fUnion.fR.fWeight = (oldStyle & SkTypeface::kBold) ? SkFontStyle::kBold_Weight
-                                                       : SkFontStyle::kNormal_Weight;
-    fUnion.fR.fWidth = SkFontStyle::kNormal_Width;
-    fUnion.fR.fSlant = (oldStyle & SkTypeface::kItalic) ? SkFontStyle::kItalic_Slant
-                                                        : SkFontStyle::kUpright_Slant;
-}
-
 #include "SkFontMgr.h"
 
 class SkEmptyFontStyleSet : public SkFontStyleSet {
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 84cbdbf..81038bc 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -14,10 +14,26 @@
 #include "SkStream.h"
 #include "SkTypeface.h"
 
-SkTypeface::SkTypeface(const SkFontStyle& style, SkFontID fontID, bool isFixedPitch)
-    : fUniqueID(fontID), fStyle(style), fIsFixedPitch(isFixedPitch) { }
+//#define TRACE_LIFECYCLE
 
-SkTypeface::~SkTypeface() { }
+#ifdef TRACE_LIFECYCLE
+    static int32_t gTypefaceCounter;
+#endif
+
+SkTypeface::SkTypeface(Style style, SkFontID fontID, bool isFixedPitch)
+    : fUniqueID(fontID), fStyle(style), fIsFixedPitch(isFixedPitch) {
+#ifdef TRACE_LIFECYCLE
+    SkDebugf("SkTypeface: create  %p fontID %d total %d\n",
+             this, fontID, ++gTypefaceCounter);
+#endif
+}
+
+SkTypeface::~SkTypeface() {
+#ifdef TRACE_LIFECYCLE
+    SkDebugf("SkTypeface: destroy %p fontID %d total %d\n",
+             this, fUniqueID, --gTypefaceCounter);
+#endif
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -27,7 +43,7 @@
         return SkNEW(SkEmptyTypeface);
     }
 protected:
-    SkEmptyTypeface() : SkTypeface(SkFontStyle(), 0, true) { }
+    SkEmptyTypeface() : SkTypeface(SkTypeface::kNormal, 0, true) { }
 
     virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE { return NULL; }
     virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK_OVERRIDE {
diff --git a/src/core/SkTypefaceCache.cpp b/src/core/SkTypefaceCache.cpp
index cfa301e..f864e1c 100644
--- a/src/core/SkTypefaceCache.cpp
+++ b/src/core/SkTypefaceCache.cpp
@@ -29,7 +29,7 @@
 }
 
 void SkTypefaceCache::add(SkTypeface* face,
-                          const SkFontStyle& requestedStyle,
+                          SkTypeface::Style requestedStyle,
                           bool strong) {
     if (fArray.count() >= TYPEFACE_CACHE_LIMIT) {
         this->purge(TYPEFACE_CACHE_LIMIT >> 2);
@@ -120,7 +120,7 @@
 SK_DECLARE_STATIC_MUTEX(gMutex);
 
 void SkTypefaceCache::Add(SkTypeface* face,
-                          const SkFontStyle& requestedStyle,
+                          SkTypeface::Style requestedStyle,
                           bool strong) {
     SkAutoMutexAcquire ama(gMutex);
     Get().add(face, requestedStyle, strong);
@@ -145,9 +145,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifdef SK_DEBUG
-static bool DumpProc(SkTypeface* face, const SkFontStyle& s, void* ctx) {
-    SkDebugf("SkTypefaceCache: face %p fontID %d weight %d width %d style %d refcnt %d\n",
-             face, face->uniqueID(), s.weight(), s.width(), s.slant(), face->getRefCnt());
+static bool DumpProc(SkTypeface* face, SkTypeface::Style style, void* ctx) {
+    SkDebugf("SkTypefaceCache: face %p fontID %d style %d refcnt %d\n",
+             face, face->uniqueID(), style, face->getRefCnt());
     return false;
 }
 #endif
diff --git a/src/core/SkTypefaceCache.h b/src/core/SkTypefaceCache.h
index ba851ee..ae37ab7 100644
--- a/src/core/SkTypefaceCache.h
+++ b/src/core/SkTypefaceCache.h
@@ -31,7 +31,7 @@
      * for the given context. The passed typeface is owned by the cache and is
      * not additionally ref()ed. The typeface may be in the disposed state.
      */
-    typedef bool(*FindProc)(SkTypeface*, const SkFontStyle&, void* context);
+    typedef bool (*FindProc)(SkTypeface*, SkTypeface::Style, void* context);
 
     /**
      *  Add a typeface to the cache. This ref()s the typeface, so that the
@@ -39,7 +39,7 @@
      *  whose refcnt is 1 (meaning only the cache is an owner) will be
      *  unref()ed.
      */
-    void add(SkTypeface*, const SkFontStyle& requested, bool strong = true);
+    void add(SkTypeface*, SkTypeface::Style requested, bool strong = true);
 
     /**
      *  Search the cache for a typeface with the specified fontID (uniqueID).
@@ -73,7 +73,7 @@
     // These are static wrappers around a global instance of a cache.
 
     static void Add(SkTypeface*,
-                    const SkFontStyle& requested,
+                    SkTypeface::Style requested,
                     bool strong = true);
     static SkTypeface* FindByID(SkFontID fontID);
     static SkTypeface* FindByProcAndRef(FindProc proc, void* ctx);
@@ -90,9 +90,9 @@
     void purge(int count);
 
     struct Rec {
-        SkTypeface* fFace;
-        bool fStrong;
-        SkFontStyle fRequestedStyle;
+        SkTypeface*         fFace;
+        bool                fStrong;
+        SkTypeface::Style   fRequestedStyle;
     };
     SkTDArray<Rec> fArray;
 };
diff --git a/src/fonts/SkFontMgr_fontconfig.cpp b/src/fonts/SkFontMgr_fontconfig.cpp
index c56e065..a7f8128 100644
--- a/src/fonts/SkFontMgr_fontconfig.cpp
+++ b/src/fonts/SkFontMgr_fontconfig.cpp
@@ -300,7 +300,7 @@
         }
 
         // TODO should the caller give us the style or should we get it from freetype?
-        SkFontStyle style;
+        SkTypeface::Style style = SkTypeface::kNormal;
         bool isFixedWidth = false;
         if (!SkTypeface_FreeType::ScanFont(stream, 0, NULL, &style, &isFixedWidth)) {
             return NULL;
diff --git a/src/fonts/SkGScalerContext.cpp b/src/fonts/SkGScalerContext.cpp
index cacc270..34a788a 100644
--- a/src/fonts/SkGScalerContext.cpp
+++ b/src/fonts/SkGScalerContext.cpp
@@ -158,7 +158,7 @@
 #include "SkTypefaceCache.h"
 
 SkGTypeface::SkGTypeface(SkTypeface* proxy, const SkPaint& paint)
-    : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false)
+    : SkTypeface(proxy->style(), SkTypefaceCache::NewFontID(), false)
     , fProxy(SkRef(proxy))
     , fPaint(paint) {}
 
diff --git a/src/fonts/SkTestScalerContext.cpp b/src/fonts/SkTestScalerContext.cpp
index b148375..ee379f0 100644
--- a/src/fonts/SkTestScalerContext.cpp
+++ b/src/fonts/SkTestScalerContext.cpp
@@ -110,8 +110,8 @@
         fPaths[index] = path;
     }
 }
-
-SkTestTypeface::SkTestTypeface(SkTestFont* testFont, const SkFontStyle& style)
+    
+SkTestTypeface::SkTestTypeface(SkTestFont* testFont, SkTypeface::Style style)
     : SkTypeface(style, SkTypefaceCache::NewFontID(), false)
     , fTestFont(testFont) {
 }
diff --git a/src/fonts/SkTestScalerContext.h b/src/fonts/SkTestScalerContext.h
index 3e6dc97..42f6049 100644
--- a/src/fonts/SkTestScalerContext.h
+++ b/src/fonts/SkTestScalerContext.h
@@ -57,7 +57,7 @@
 
 class SkTestTypeface : public SkTypeface {
 public:
-    SkTestTypeface(SkTestFont*, const SkFontStyle& style);
+    SkTestTypeface(SkTestFont* , SkTypeface::Style style);
     virtual ~SkTestTypeface() {
         SkSafeUnref(fTestFont);
     }
diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h
index c7d8e26..f62d99d 100644
--- a/src/ports/SkFontConfigTypeface.h
+++ b/src/ports/SkFontConfigTypeface.h
@@ -18,14 +18,13 @@
     SkStream* fLocalStream;
 
 public:
-    static FontConfigTypeface* Create(const SkFontStyle& style,
+    static FontConfigTypeface* Create(Style style,
                                       const SkFontConfigInterface::FontIdentity& fi,
                                       const SkString& familyName) {
         return SkNEW_ARGS(FontConfigTypeface, (style, fi, familyName));
     }
 
-    static FontConfigTypeface* Create(const SkFontStyle& style, bool fixedWidth,
-                                      SkStream* localStream) {
+    static FontConfigTypeface* Create(Style style, bool fixedWidth, SkStream* localStream) {
         return SkNEW_ARGS(FontConfigTypeface, (style, fixedWidth, localStream));
     }
 
@@ -51,7 +50,7 @@
 protected:
     friend class SkFontHost;    // hack until we can make public versions
 
-    FontConfigTypeface(const SkFontStyle& style,
+    FontConfigTypeface(Style style,
                        const SkFontConfigInterface::FontIdentity& fi,
                        const SkString& familyName)
             : INHERITED(style, SkTypefaceCache::NewFontID(), false)
@@ -59,7 +58,7 @@
             , fFamilyName(familyName)
             , fLocalStream(NULL) {}
 
-    FontConfigTypeface(const SkFontStyle& style, bool fixedWidth, SkStream* localStream)
+    FontConfigTypeface(Style style, bool fixedWidth, SkStream* localStream)
             : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) {
         // we default to empty fFamilyName and fIdentity
         fLocalStream = localStream;
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index f3a87e5..85f8ab9 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1669,9 +1669,8 @@
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "SkTSearch.h"
 /*static*/ bool SkTypeface_FreeType::ScanFont(
-    SkStream* stream, int ttcIndex, SkString* name, SkFontStyle* style, bool* isFixedPitch)
+    SkStream* stream, int ttcIndex, SkString* name, SkTypeface::Style* style, bool* isFixedPitch)
 {
     FT_Library  library;
     if (FT_Init_FreeType(&library)) {
@@ -1705,61 +1704,19 @@
         return false;
     }
 
-    int weight = SkFontStyle::kNormal_Weight;
-    int width = SkFontStyle::kNormal_Width;
-    SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant;
+    int tempStyle = SkTypeface::kNormal;
     if (face->style_flags & FT_STYLE_FLAG_BOLD) {
-        weight = SkFontStyle::kBold_Weight;
+        tempStyle |= SkTypeface::kBold;
     }
     if (face->style_flags & FT_STYLE_FLAG_ITALIC) {
-        slant = SkFontStyle::kItalic_Slant;
-    }
-
-    PS_FontInfoRec psFontInfo;
-    TT_OS2* os2 = static_cast<TT_OS2*>(FT_Get_Sfnt_Table(face, ft_sfnt_os2));
-    if (os2 && os2->version != 0xffff) {
-        weight = os2->usWeightClass;
-        width = os2->usWidthClass;
-    } else if (0 == FT_Get_PS_Font_Info(face, &psFontInfo) && psFontInfo.weight) {
-        static const struct {
-            char const * const name;
-            int const weight;
-        } commonWeights [] = {
-            // There are probably more common names, but these are known to exist.
-            { "black", SkFontStyle::kBlack_Weight },
-            { "bold", SkFontStyle::kBold_Weight },
-            { "book", (SkFontStyle::kNormal_Weight + SkFontStyle::kLight_Weight)/2 },
-            { "demi", SkFontStyle::kSemiBold_Weight },
-            { "demibold", SkFontStyle::kSemiBold_Weight },
-            { "extrabold", SkFontStyle::kExtraBold_Weight },
-            { "extralight", SkFontStyle::kExtraLight_Weight },
-            { "heavy", SkFontStyle::kBlack_Weight },
-            { "light", SkFontStyle::kLight_Weight },
-            { "medium", SkFontStyle::kMedium_Weight },
-            { "normal", SkFontStyle::kNormal_Weight },
-            { "regular", SkFontStyle::kNormal_Weight },
-            { "semibold", SkFontStyle::kSemiBold_Weight },
-            { "thin", SkFontStyle::kThin_Weight },
-            { "ultra", SkFontStyle::kExtraBold_Weight },
-            { "ultrablack", 1000 },
-            { "ultrabold", SkFontStyle::kExtraBold_Weight },
-            { "ultraheavy", 1000 },
-            { "ultralight", SkFontStyle::kExtraLight_Weight },
-        };
-        int const index = SkStrLCSearch(&commonWeights[0].name, SK_ARRAY_COUNT(commonWeights),
-                                        psFontInfo.weight, sizeof(commonWeights));
-        if (index >= 0) {
-            weight = commonWeights[index].weight;
-        } else {
-            SkDEBUGF(("Do not know weight for: %s\n", psFontInfo.weight));
-        }
+        tempStyle |= SkTypeface::kItalic;
     }
 
     if (name) {
         name->set(face->family_name);
     }
     if (style) {
-        *style = SkFontStyle(weight, width, slant);
+        *style = (SkTypeface::Style) tempStyle;
     }
     if (isFixedPitch) {
         *isFixedPitch = FT_IS_FIXED_WIDTH(face);
diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h
index 79e6d65..f093dba 100644
--- a/src/ports/SkFontHost_FreeType_common.h
+++ b/src/ports/SkFontHost_FreeType_common.h
@@ -49,10 +49,10 @@
      *  name and style from a stream, using FreeType's API.
      */
     static bool ScanFont(SkStream* stream, int ttcIndex,
-                         SkString* name, SkFontStyle* style, bool* isFixedPitch);
+                         SkString* name, SkTypeface::Style* style, bool* isFixedPitch);
 
 protected:
-    SkTypeface_FreeType(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch)
+    SkTypeface_FreeType(Style style, SkFontID uniqueID, bool isFixedPitch)
         : INHERITED(style, uniqueID, isFixedPitch)
         , fGlyphCount(-1)
     {}
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
index 32e9f80..b3a893e 100644
--- a/src/ports/SkFontHost_fontconfig.cpp
+++ b/src/ports/SkFontHost_fontconfig.cpp
@@ -60,20 +60,19 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 struct FindRec {
-    FindRec(const char* name, const SkFontStyle& style)
+    FindRec(const char* name, SkTypeface::Style style)
         : fFamilyName(name)  // don't need to make a deep copy
         , fStyle(style) {}
 
     const char* fFamilyName;
-    SkFontStyle fStyle;
+    SkTypeface::Style fStyle;
 };
 
-static bool find_proc(SkTypeface* cachedTypeface, const SkFontStyle& cachedStyle, void* ctx) {
-    FontConfigTypeface* cachedFCTypeface = (FontConfigTypeface*)cachedTypeface;
-    const FindRec* rec = static_cast<const FindRec*>(ctx);
+static bool find_proc(SkTypeface* face, SkTypeface::Style style, void* ctx) {
+    FontConfigTypeface* fci = (FontConfigTypeface*)face;
+    const FindRec* rec = (const FindRec*)ctx;
 
-    return rec->fStyle == cachedStyle &&
-           cachedFCTypeface->isFamilyName(rec->fFamilyName);
+    return rec->fStyle == style && fci->isFamilyName(rec->fFamilyName);
 }
 
 SkTypeface* FontConfigTypeface::LegacyCreateTypeface(
@@ -90,37 +89,34 @@
         familyName = fct->getFamilyName();
     }
 
-    SkFontStyle requestedStyle(style);
-    FindRec rec(familyName, requestedStyle);
+    FindRec rec(familyName, style);
     SkTypeface* face = SkTypefaceCache::FindByProcAndRef(find_proc, &rec);
     if (face) {
-        //SkDebugf("found cached face <%s> <%s> %p [%d]\n",
-        //         familyName, ((FontConfigTypeface*)face)->getFamilyName(),
-        //         face, face->getRefCnt());
+//        SkDebugf("found cached face <%s> <%s> %p [%d]\n", familyName, ((FontConfigTypeface*)face)->getFamilyName(), face, face->getRefCnt());
         return face;
     }
 
     SkFontConfigInterface::FontIdentity indentity;
-    SkString outFamilyName;
-    SkTypeface::Style outStyle;
-    if (!fci->matchFamilyName(familyName, style, &indentity, &outFamilyName, &outStyle)) {
+    SkString                            outFamilyName;
+    SkTypeface::Style                   outStyle;
+
+    if (!fci->matchFamilyName(familyName, style,
+                              &indentity, &outFamilyName, &outStyle)) {
         return NULL;
     }
 
     // check if we, in fact, already have this. perhaps fontconfig aliased the
     // requested name to some other name we actually have...
     rec.fFamilyName = outFamilyName.c_str();
-    rec.fStyle = SkFontStyle(outStyle);
+    rec.fStyle = outStyle;
     face = SkTypefaceCache::FindByProcAndRef(find_proc, &rec);
     if (face) {
         return face;
     }
 
-    face = FontConfigTypeface::Create(SkFontStyle(outStyle), indentity, outFamilyName);
-    SkTypefaceCache::Add(face, requestedStyle);
-    //SkDebugf("add face <%s> <%s> %p [%d]\n",
-    //         familyName, outFamilyName.c_str(),
-    //         face, face->getRefCnt());
+    face = FontConfigTypeface::Create(outStyle, indentity, outFamilyName);
+    SkTypefaceCache::Add(face, style);
+//    SkDebugf("add face <%s> <%s> %p [%d]\n", familyName, outFamilyName.c_str(), face, face->getRefCnt());
     return face;
 }
 
diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp
index 90141f9..a4202aa 100644
--- a/src/ports/SkFontHost_linux.cpp
+++ b/src/ports/SkFontHost_linux.cpp
@@ -30,7 +30,7 @@
 /** The base SkTypeface implementation for the custom font manager. */
 class SkTypeface_Custom : public SkTypeface_FreeType {
 public:
-    SkTypeface_Custom(const SkFontStyle& style, bool isFixedPitch,
+    SkTypeface_Custom(Style style, bool isFixedPitch,
                       bool sysFont, const SkString familyName, int index)
         : INHERITED(style, SkTypefaceCache::NewFontID(), isFixedPitch)
         , fIsSysFont(sysFont), fFamilyName(familyName), fIndex(index)
@@ -67,7 +67,7 @@
  */
 class SkTypeface_Empty : public SkTypeface_Custom {
 public:
-    SkTypeface_Empty() : INHERITED(SkFontStyle(), false, true, SkString(), 0) {}
+    SkTypeface_Empty() : INHERITED(SkTypeface::kNormal, false, true, SkString(), 0) {}
 
     virtual const char* getUniqueString() const SK_OVERRIDE { return NULL; }
 
@@ -81,9 +81,9 @@
 /** The stream SkTypeface implementation for the custom font manager. */
 class SkTypeface_Stream : public SkTypeface_Custom {
 public:
-    SkTypeface_Stream(const SkFontStyle& style, bool isFixedPitch, bool sysFont,
-                      const SkString familyName, SkStream* stream, int index)
-        : INHERITED(style, isFixedPitch, sysFont, familyName, index)
+    SkTypeface_Stream(Style style, bool isFixedPitch, bool sysFont, const SkString familyName,
+                      SkStream* stream, int ttcIndex)
+        : INHERITED(style, isFixedPitch, sysFont, familyName, ttcIndex)
         , fStream(SkRef(stream))
     { }
 
@@ -104,8 +104,8 @@
 /** The file SkTypeface implementation for the custom font manager. */
 class SkTypeface_File : public SkTypeface_Custom {
 public:
-    SkTypeface_File(const SkFontStyle& style, bool isFixedPitch, bool sysFont,
-                    const SkString familyName, const char path[], int index)
+    SkTypeface_File(Style style, bool isFixedPitch, bool sysFont, const SkString familyName,
+                    const char path[], int index)
         : INHERITED(style, isFixedPitch, sysFont, familyName, index)
         , fPath(path)
     { }
@@ -273,7 +273,7 @@
         }
 
         bool isFixedPitch;
-        SkFontStyle style;
+        SkTypeface::Style style;
         SkString name;
         if (SkTypeface_FreeType::ScanFont(stream, ttcIndex, &name, &style, &isFixedPitch)) {
             return SkNEW_ARGS(SkTypeface_Stream, (style, isFixedPitch, false, name,
@@ -315,7 +315,7 @@
 private:
 
     static bool get_name_and_style(const char path[], SkString* name,
-                                   SkFontStyle* style, bool* isFixedPitch) {
+                                   SkTypeface::Style* style, bool* isFixedPitch) {
         SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
         if (stream.get()) {
             return SkTypeface_FreeType::ScanFont(stream, 0, name, style, isFixedPitch);
@@ -335,7 +335,8 @@
 
             bool isFixedPitch;
             SkString realname;
-            SkFontStyle style = SkFontStyle(); // avoid uninitialized warning
+            SkTypeface::Style style = SkTypeface::kNormal; // avoid uninitialized warning
+
             if (!get_name_and_style(filename.c_str(), &realname, &style, &isFixedPitch)) {
                 SkDebugf("------ can't load <%s> as a font\n", filename.c_str());
                 continue;
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 4e57354..aae7464 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -6,6 +6,7 @@
  * found in the LICENSE file.
  */
 
+#include <vector>
 #ifdef SK_BUILD_FOR_MAC
 #import <ApplicationServices/ApplicationServices.h>
 #endif
@@ -351,70 +352,20 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-static bool find_dict_traits(CFDictionaryRef dict, CTFontSymbolicTraits* traits) {
-    CFNumberRef num;
-    return CFDictionaryGetValueIfPresent(dict, kCTFontSymbolicTrait, (const void**)&num)
-    && CFNumberIsFloatType(num)
-    && CFNumberGetValue(num, kCFNumberSInt32Type, traits);
-}
+static SkTypeface::Style computeStyleBits(CTFontRef font, bool* isFixedPitch) {
+    unsigned style = SkTypeface::kNormal;
+    CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(font);
 
-static bool find_dict_float(CFDictionaryRef dict, CFStringRef name, float* value) {
-    CFNumberRef num;
-    return CFDictionaryGetValueIfPresent(dict, name, (const void**)&num)
-    && CFNumberIsFloatType(num)
-    && CFNumberGetValue(num, kCFNumberFloatType, value);
-}
-
-static int unit_weight_to_fontstyle(float unit) {
-    float value;
-    if (unit < 0) {
-        value = 100 + (1 + unit) * 300;
-    } else {
-        value = 400 + unit * 500;
+    if (traits & kCTFontBoldTrait) {
+        style |= SkTypeface::kBold;
     }
-    return sk_float_round2int(value);
-}
-
-static int unit_width_to_fontstyle(float unit) {
-    float value;
-    if (unit < 0) {
-        value = 1 + (1 + unit) * 4;
-    } else {
-        value = 5 + unit * 4;
-    }
-    return sk_float_round2int(value);
-}
-
-static SkFontStyle fontstyle_from_descriptor(CTFontDescriptorRef desc, bool* isFixedPitch) {
-    AutoCFRelease<CFDictionaryRef> dict(
-            (CFDictionaryRef)CTFontDescriptorCopyAttribute(desc, kCTFontTraitsAttribute));
-    if (NULL == dict.get()) {
-        return SkFontStyle();
-    }
-
-    CTFontSymbolicTraits traits;
-    if (!find_dict_traits(dict, &traits)) {
-        traits = 0;
+    if (traits & kCTFontItalicTrait) {
+        style |= SkTypeface::kItalic;
     }
     if (isFixedPitch) {
-        *isFixedPitch = SkToBool(traits & kCTFontMonoSpaceTrait);
+        *isFixedPitch = (traits & kCTFontMonoSpaceTrait) != 0;
     }
-
-    float weight, width, slant;
-    if (!find_dict_float(dict, kCTFontWeightTrait, &weight)) {
-        weight = (traits & kCTFontBoldTrait) ? 0.5f : 0;
-    }
-    if (!find_dict_float(dict, kCTFontWidthTrait, &width)) {
-        width = 0;
-    }
-    if (!find_dict_float(dict, kCTFontSlantTrait, &slant)) {
-        slant = (traits & kCTFontItalicTrait) ? 0.5f : 0;
-    }
-
-    return SkFontStyle(unit_weight_to_fontstyle(weight),
-                       unit_width_to_fontstyle(width),
-                       slant ? SkFontStyle::kItalic_Slant
-                       : SkFontStyle::kUpright_Slant);
+    return (SkTypeface::Style)style;
 }
 
 static SkFontID CTFontRef_to_SkFontID(CTFontRef fontRef) {
@@ -445,15 +396,48 @@
     return id;
 }
 
+static SkFontStyle stylebits2fontstyle(SkTypeface::Style styleBits) {
+    return SkFontStyle((styleBits & SkTypeface::kBold)
+                           ? SkFontStyle::kBold_Weight
+                           : SkFontStyle::kNormal_Weight,
+                       SkFontStyle::kNormal_Width,
+                       (styleBits & SkTypeface::kItalic)
+                           ? SkFontStyle::kItalic_Slant
+                           : SkFontStyle::kUpright_Slant);
+}
+
 #define WEIGHT_THRESHOLD    ((SkFontStyle::kNormal_Weight + SkFontStyle::kBold_Weight)/2)
 
+static SkTypeface::Style fontstyle2stylebits(const SkFontStyle& fs) {
+    unsigned style = 0;
+    if (fs.width() >= WEIGHT_THRESHOLD) {
+        style |= SkTypeface::kBold;
+    }
+    if (fs.isItalic()) {
+        style |= SkTypeface::kItalic;
+    }
+    return (SkTypeface::Style)style;
+}
+
 class SkTypeface_Mac : public SkTypeface {
 public:
-    SkTypeface_Mac(const SkFontStyle& fs, SkFontID fontID, bool isFixedPitch,
+    SkTypeface_Mac(SkTypeface::Style style, SkFontID fontID, bool isFixedPitch,
                    CTFontRef fontRef, const char name[], bool isLocalStream)
-        : SkTypeface(fs, fontID, isFixedPitch)
+        : SkTypeface(style, fontID, isFixedPitch)
         , fName(name)
         , fFontRef(fontRef) // caller has already called CFRetain for us
+        , fFontStyle(stylebits2fontstyle(style))
+        , fIsLocalStream(isLocalStream)
+    {
+        SkASSERT(fontRef);
+    }
+
+    SkTypeface_Mac(const SkFontStyle& fs, SkFontID fontID, bool isFixedPitch,
+                   CTFontRef fontRef, const char name[], bool isLocalStream)
+        : SkTypeface(fontstyle2stylebits(fs), fontID, isFixedPitch)
+        , fName(name)
+        , fFontRef(fontRef) // caller has already called CFRetain for us
+        , fFontStyle(fs)
         , fIsLocalStream(isLocalStream)
     {
         SkASSERT(fontRef);
@@ -461,6 +445,7 @@
 
     SkString fName;
     AutoCFRelease<CTFontRef> fFontRef;
+    SkFontStyle fFontStyle;
 
 protected:
     friend class SkFontHost;    // to access our protected members for deprecated methods
@@ -491,26 +476,23 @@
 static SkTypeface* NewFromFontRef(CTFontRef fontRef, const char name[], bool isLocalStream) {
     SkASSERT(fontRef);
     bool isFixedPitch;
-    AutoCFRelease<CTFontDescriptorRef> desc(CTFontCopyFontDescriptor(fontRef));
-    SkFontStyle style = fontstyle_from_descriptor(desc, &isFixedPitch);
+    SkTypeface::Style style = computeStyleBits(fontRef, &isFixedPitch);
     SkFontID fontID = CTFontRef_to_SkFontID(fontRef);
 
     return new SkTypeface_Mac(style, fontID, isFixedPitch, fontRef, name, isLocalStream);
 }
 
-static SkTypeface* NewFromName(const char familyName[], const SkFontStyle& theStyle) {
+static SkTypeface* NewFromName(const char familyName[], SkTypeface::Style theStyle) {
     CTFontRef ctFont = NULL;
 
     CTFontSymbolicTraits ctFontTraits = 0;
-    if (theStyle.weight() >= SkFontStyle::kBold_Weight) {
+    if (theStyle & SkTypeface::kBold) {
         ctFontTraits |= kCTFontBoldTrait;
     }
-    if (theStyle.slant() != SkFontStyle::kUpright_Slant) {
+    if (theStyle & SkTypeface::kItalic) {
         ctFontTraits |= kCTFontItalicTrait;
     }
 
-    //TODO: add weight width slant
-
     // Create the font info
     AutoCFRelease<CFStringRef> cfFontName(make_CFString(familyName));
 
@@ -552,8 +534,8 @@
     static SkTypeface* gDefaultFace;
 
     if (NULL == gDefaultFace) {
-        gDefaultFace = NewFromName(FONT_DEFAULT_NAME, SkFontStyle());
-        SkTypefaceCache::Add(gDefaultFace, SkFontStyle());
+        gDefaultFace = NewFromName(FONT_DEFAULT_NAME, SkTypeface::kNormal);
+        SkTypefaceCache::Add(gDefaultFace, SkTypeface::kNormal);
     }
     return gDefaultFace;
 }
@@ -576,7 +558,7 @@
         face->ref();
     } else {
         face = NewFromFontRef(fontRef, NULL, false);
-        SkTypefaceCache::Add(face, face->fontStyle());
+        SkTypefaceCache::Add(face, face->style());
         // NewFromFontRef doesn't retain the parameter, but the typeface it
         // creates does release it in its destructor, so we balance that with
         // a retain call here.
@@ -588,10 +570,11 @@
 
 struct NameStyleRec {
     const char*         fName;
-    SkFontStyle   fStyle;
+    SkTypeface::Style   fStyle;
 };
 
-static bool FindByNameStyle(SkTypeface* face, const SkFontStyle& style, void* ctx) {
+static bool FindByNameStyle(SkTypeface* face, SkTypeface::Style style,
+                            void* ctx) {
     const SkTypeface_Mac* mface = reinterpret_cast<SkTypeface_Mac*>(face);
     const NameStyleRec* rec = reinterpret_cast<const NameStyleRec*>(ctx);
 
@@ -616,6 +599,39 @@
     return name;    // no change
 }
 
+static SkTypeface* create_typeface(const SkTypeface* familyFace,
+                                   const char familyName[],
+                                   SkTypeface::Style style) {
+    if (familyName) {
+        familyName = map_css_names(familyName);
+    }
+
+    // Clone an existing typeface
+    // TODO: only clone if style matches the familyFace's style...
+    if (familyName == NULL && familyFace != NULL) {
+        familyFace->ref();
+        return const_cast<SkTypeface*>(familyFace);
+    }
+
+    if (!familyName || !*familyName) {
+        familyName = FONT_DEFAULT_NAME;
+    }
+
+    NameStyleRec rec = { familyName, style };
+    SkTypeface* face = SkTypefaceCache::FindByProcAndRef(FindByNameStyle, &rec);
+
+    if (NULL == face) {
+        face = NewFromName(familyName, style);
+        if (face) {
+            SkTypefaceCache::Add(face, style);
+        } else {
+            face = GetDefaultFace();
+            face->ref();
+        }
+    }
+    return face;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 /** GlyphRect is in FUnits (em space, y up). */
@@ -1992,6 +2008,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
+#if 1
 
 static bool find_desc_str(CTFontDescriptorRef desc, CFStringRef name, SkString* value) {
     AutoCFRelease<CFStringRef> ref((CFStringRef)CTFontDescriptorCopyAttribute(desc, name));
@@ -2002,8 +2019,35 @@
     return true;
 }
 
+static bool find_dict_float(CFDictionaryRef dict, CFStringRef name, float* value) {
+    CFNumberRef num;
+    return CFDictionaryGetValueIfPresent(dict, name, (const void**)&num)
+    && CFNumberIsFloatType(num)
+    && CFNumberGetValue(num, kCFNumberFloatType, value);
+}
+
 #include "SkFontMgr.h"
 
+static int unit_weight_to_fontstyle(float unit) {
+    float value;
+    if (unit < 0) {
+        value = 100 + (1 + unit) * 300;
+    } else {
+        value = 400 + unit * 500;
+    }
+    return sk_float_round2int(value);
+}
+
+static int unit_width_to_fontstyle(float unit) {
+    float value;
+    if (unit < 0) {
+        value = 1 + (1 + unit) * 4;
+    } else {
+        value = 5 + unit * 4;
+    }
+    return sk_float_round2int(value);
+}
+
 static inline int sqr(int value) {
     SkASSERT(SkAbs32(value) < 0x7FFF);  // check for overflow
     return value * value;
@@ -2016,25 +2060,53 @@
            sqr((a.isItalic() != b.isItalic()) * 900);
 }
 
+static SkFontStyle desc2fontstyle(CTFontDescriptorRef desc) {
+    AutoCFRelease<CFDictionaryRef> dict(
+        (CFDictionaryRef)CTFontDescriptorCopyAttribute(desc,
+                                                       kCTFontTraitsAttribute));
+    if (NULL == dict.get()) {
+        return SkFontStyle();
+    }
+
+    float weight, width, slant;
+    if (!find_dict_float(dict, kCTFontWeightTrait, &weight)) {
+        weight = 0;
+    }
+    if (!find_dict_float(dict, kCTFontWidthTrait, &width)) {
+        width = 0;
+    }
+    if (!find_dict_float(dict, kCTFontSlantTrait, &slant)) {
+        slant = 0;
+    }
+
+    return SkFontStyle(unit_weight_to_fontstyle(weight),
+                       unit_width_to_fontstyle(width),
+                       slant ? SkFontStyle::kItalic_Slant
+                       : SkFontStyle::kUpright_Slant);
+}
+
 struct NameFontStyleRec {
     SkString    fFamilyName;
     SkFontStyle fFontStyle;
 };
 
-static bool nameFontStyleProc(SkTypeface* face, const SkFontStyle&, void* ctx) {
+static bool nameFontStyleProc(SkTypeface* face, SkTypeface::Style,
+                              void* ctx) {
     SkTypeface_Mac* macFace = (SkTypeface_Mac*)face;
     const NameFontStyleRec* rec = (const NameFontStyleRec*)ctx;
 
-    return macFace->fontStyle() == rec->fFontStyle &&
+    return macFace->fFontStyle == rec->fFontStyle &&
            macFace->fName == rec->fFamilyName;
 }
 
-static SkTypeface* createFromDesc(CFStringRef cfFamilyName, CTFontDescriptorRef desc) {
+static SkTypeface* createFromDesc(CFStringRef cfFamilyName,
+                                  CTFontDescriptorRef desc) {
     NameFontStyleRec rec;
     CFStringToSkString(cfFamilyName, &rec.fFamilyName);
-    rec.fFontStyle = fontstyle_from_descriptor(desc, NULL);
+    rec.fFontStyle = desc2fontstyle(desc);
 
-    SkTypeface* face = SkTypefaceCache::FindByProcAndRef(nameFontStyleProc, &rec);
+    SkTypeface* face = SkTypefaceCache::FindByProcAndRef(nameFontStyleProc,
+                                                         &rec);
     if (face) {
         return face;
     }
@@ -2055,13 +2127,12 @@
     CFStringToSkString(cfFamilyName, &str);
 
     bool isFixedPitch;
-    AutoCFRelease<CTFontDescriptorRef> ctFontDesc(CTFontCopyFontDescriptor(ctFont));
-    (void)fontstyle_from_descriptor(ctFontDesc, &isFixedPitch);
+    (void)computeStyleBits(ctFont, &isFixedPitch);
     SkFontID fontID = CTFontRef_to_SkFontID(ctFont);
 
     face = SkNEW_ARGS(SkTypeface_Mac, (rec.fFontStyle, fontID, isFixedPitch,
                                        ctFont, str.c_str(), false));
-    SkTypefaceCache::Add(face, face->fontStyle());
+    SkTypefaceCache::Add(face, face->style());
     return face;
 }
 
@@ -2087,11 +2158,12 @@
         return fCount;
     }
 
-    virtual void getStyle(int index, SkFontStyle* style, SkString* name) SK_OVERRIDE {
+    virtual void getStyle(int index, SkFontStyle* style,
+                          SkString* name) SK_OVERRIDE {
         SkASSERT((unsigned)index < (unsigned)fCount);
         CTFontDescriptorRef desc = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fArray, index);
         if (style) {
-            *style = fontstyle_from_descriptor(desc, NULL);
+            *style = desc2fontstyle(desc);
         }
         if (name) {
             if (!find_desc_str(desc, kCTFontStyleNameAttribute, name)) {
@@ -2125,7 +2197,7 @@
 
         for (int i = 0; i < fCount; ++i) {
             CTFontDescriptorRef desc = (CTFontDescriptorRef)CFArrayGetValueAtIndex(fArray, i);
-            int metric = compute_metric(pattern, fontstyle_from_descriptor(desc, NULL));
+            int metric = compute_metric(pattern, desc2fontstyle(desc));
             if (0 == metric) {
                 return desc;
             }
@@ -2205,7 +2277,8 @@
         return NULL;
     }
 
-    virtual SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const SK_OVERRIDE {
+    virtual SkTypeface* onCreateFromData(SkData* data,
+                                         int ttcIndex) const SK_OVERRIDE {
         AutoCFRelease<CGDataProviderRef> pr(SkCreateDataProviderFromData(data));
         if (NULL == pr) {
             return NULL;
@@ -2213,7 +2286,8 @@
         return create_from_dataProvider(pr);
     }
 
-    virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE {
+    virtual SkTypeface* onCreateFromStream(SkStream* stream,
+                                           int ttcIndex) const SK_OVERRIDE {
         AutoCFRelease<CGDataProviderRef> pr(SkCreateDataProviderFromStream(stream));
         if (NULL == pr) {
             return NULL;
@@ -2221,7 +2295,8 @@
         return create_from_dataProvider(pr);
     }
 
-    virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const SK_OVERRIDE {
+    virtual SkTypeface* onCreateFromFile(const char path[],
+                                         int ttcIndex) const SK_OVERRIDE {
         AutoCFRelease<CGDataProviderRef> pr(CGDataProviderCreateWithFilename(path));
         if (NULL == pr) {
             return NULL;
@@ -2231,29 +2306,7 @@
 
     virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
                                                unsigned styleBits) const SK_OVERRIDE {
-
-        SkFontStyle style = SkFontStyle((SkTypeface::Style)styleBits);
-        if (familyName) {
-            familyName = map_css_names(familyName);
-        }
-
-        if (!familyName || !*familyName) {
-            familyName = FONT_DEFAULT_NAME;
-        }
-
-        NameStyleRec rec = { familyName, style };
-        SkTypeface* face = SkTypefaceCache::FindByProcAndRef(FindByNameStyle, &rec);
-
-        if (NULL == face) {
-            face = NewFromName(familyName, style);
-            if (face) {
-                SkTypefaceCache::Add(face, style);
-            } else {
-                face = GetDefaultFace();
-                face->ref();
-            }
-        }
-        return face;
+        return create_typeface(NULL, familyName, (SkTypeface::Style)styleBits);
     }
 };
 
@@ -2262,3 +2315,4 @@
 SkFontMgr* SkFontMgr::Factory() {
     return SkNEW(SkFontMgr_Mac);
 }
+#endif
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 348246b..1290c00 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -126,10 +126,20 @@
 //    lf->lfClipPrecision = 64;
 }
 
-static SkFontStyle get_style(const LOGFONT& lf) {
-    return SkFontStyle(lf.lfWeight,
-                       lf.lfWidth,
-                       lf.lfItalic ? SkFontStyle::kItalic_Slant : SkFontStyle::kUpright_Slant);
+static SkTypeface::Style get_style(const LOGFONT& lf) {
+    unsigned style = 0;
+    if (lf.lfWeight >= FW_BOLD) {
+        style |= SkTypeface::kBold;
+    }
+    if (lf.lfItalic) {
+        style |= SkTypeface::kItalic;
+    }
+    return static_cast<SkTypeface::Style>(style);
+}
+
+static void setStyle(LOGFONT* lf, SkTypeface::Style style) {
+    lf->lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL ;
+    lf->lfItalic = ((style & SkTypeface::kItalic) != 0);
 }
 
 static inline FIXED SkFixedToFIXED(SkFixed x) {
@@ -207,11 +217,8 @@
 
 class LogFontTypeface : public SkTypeface {
 public:
-    LogFontTypeface(const SkFontStyle& style, const LOGFONT& lf, bool serializeAsStream)
-        : SkTypeface(style, SkTypefaceCache::NewFontID(), false)
-        , fLogFont(lf)
-        , fSerializeAsStream(serializeAsStream)
-    {
+    LogFontTypeface(SkTypeface::Style style, SkFontID fontID, const LOGFONT& lf, bool serializeAsStream = false) :
+        SkTypeface(style, fontID, false), fLogFont(lf), fSerializeAsStream(serializeAsStream) {
 
         // If the font has cubic outlines, it will not be rendered with ClearType.
         HFONT font = CreateFontIndirect(&lf);
@@ -248,7 +255,9 @@
     bool fCanBeLCD;
 
     static LogFontTypeface* Create(const LOGFONT& lf) {
-        return new LogFontTypeface(get_style(lf), lf, false);
+        SkTypeface::Style style = get_style(lf);
+        SkFontID fontID = SkTypefaceCache::NewFontID();
+        return new LogFontTypeface(style, fontID, lf);
     }
 
     static void EnsureAccessible(const SkTypeface* face) {
@@ -280,7 +289,9 @@
      *  The created FontMemResourceTypeface takes ownership of fontMemResource.
      */
     static FontMemResourceTypeface* Create(const LOGFONT& lf, HANDLE fontMemResource) {
-        return new FontMemResourceTypeface(get_style(lf), lf, fontMemResource);
+        SkTypeface::Style style = get_style(lf);
+        SkFontID fontID = SkTypefaceCache::NewFontID();
+        return new FontMemResourceTypeface(style, fontID, lf, fontMemResource);
     }
 
 protected:
@@ -294,9 +305,9 @@
     /**
      *  Takes ownership of fontMemResource.
      */
-    FontMemResourceTypeface(const SkFontStyle& style, const LOGFONT& lf, HANDLE fontMemResource)
-        : LogFontTypeface(style, lf, true), fFontMemResource(fontMemResource)
-    { }
+    FontMemResourceTypeface(SkTypeface::Style style, SkFontID fontID, const LOGFONT& lf, HANDLE fontMemResource) :
+        LogFontTypeface(style, fontID, lf, true), fFontMemResource(fontMemResource) {
+    }
 
     HANDLE fFontMemResource;
 
@@ -308,7 +319,7 @@
     return gDefaultFont;
 }
 
-static bool FindByLogFont(SkTypeface* face, const SkFontStyle& requestedStyle, void* ctx) {
+static bool FindByLogFont(SkTypeface* face, SkTypeface::Style requestedStyle, void* ctx) {
     LogFontTypeface* lface = static_cast<LogFontTypeface*>(face);
     const LOGFONT* lf = reinterpret_cast<const LOGFONT*>(ctx);
 
@@ -2446,6 +2457,12 @@
     return 1; // non-zero means continue
 }
 
+static SkFontStyle compute_fontstyle(const LOGFONT& lf) {
+    return SkFontStyle(lf.lfWeight, SkFontStyle::kNormal_Width,
+                       lf.lfItalic ? SkFontStyle::kItalic_Slant
+                                   : SkFontStyle::kUpright_Slant);
+}
+
 class SkFontStyleSetGDI : public SkFontStyleSet {
 public:
     SkFontStyleSetGDI(const TCHAR familyName[]) {
@@ -2465,7 +2482,7 @@
 
     virtual void getStyle(int index, SkFontStyle* fs, SkString* styleName) SK_OVERRIDE {
         if (fs) {
-            *fs = get_style(fArray[index].elfLogFont);
+            *fs = compute_fontstyle(fArray[index].elfLogFont);
         }
         if (styleName) {
             const ENUMLOGFONTEX& ref = fArray[index];
@@ -2568,10 +2585,7 @@
         } else {
             logfont_for_name(familyName, &lf);
         }
-
-        SkTypeface::Style style = (SkTypeface::Style)styleBits;
-        lf.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL;
-        lf.lfItalic = ((style & SkTypeface::kItalic) != 0);
+        setStyle(&lf, (SkTypeface::Style)styleBits);
         return SkCreateTypefaceFromLOGFONT(lf);
     }
 
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 15f1d3e..5e93bf8 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -42,7 +42,7 @@
 class SkTypeface_Android : public SkTypeface_FreeType {
 public:
     SkTypeface_Android(int index,
-                       const SkFontStyle& style,
+                       Style style,
                        bool isFixedPitch,
                        const SkString familyName)
         : INHERITED(style, SkTypefaceCache::NewFontID(), isFixedPitch)
@@ -65,7 +65,7 @@
 public:
     SkTypeface_AndroidSystem(const SkString pathName,
                              int index,
-                             const SkFontStyle& style,
+                             Style style,
                              bool isFixedPitch,
                              const SkString familyName,
                              const SkLanguage& lang,
@@ -100,7 +100,7 @@
 public:
     SkTypeface_AndroidStream(SkStream* stream,
                              int index,
-                             const SkFontStyle& style,
+                             Style style,
                              bool isFixedPitch,
                              const SkString familyName)
         : INHERITED(index, style, isFixedPitch, familyName)
@@ -158,7 +158,7 @@
 
             const int ttcIndex = fontFile.fIndex;
             SkString familyName;
-            SkFontStyle style;
+            SkTypeface::Style style;
             bool isFixedWidth;
             if (!SkTypeface_FreeType::ScanFont(stream.get(), ttcIndex,
                                                &familyName, &style, &isFixedWidth)) {
@@ -404,7 +404,7 @@
 
     virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE {
         bool isFixedPitch;
-        SkFontStyle style;
+        SkTypeface::Style style;
         SkString name;
         if (!SkTypeface_FreeType::ScanFont(stream, ttcIndex, &name, &style, &isFixedPitch)) {
             return NULL;
@@ -416,7 +416,14 @@
 
     virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
                                                unsigned styleBits) const SK_OVERRIDE {
-        SkFontStyle style = SkFontStyle(styleBits);
+        SkTypeface::Style oldStyle = (SkTypeface::Style)styleBits;
+        SkFontStyle style = SkFontStyle(oldStyle & SkTypeface::kBold
+                                                 ? SkFontStyle::kBold_Weight
+                                                 : SkFontStyle::kNormal_Weight,
+                                        SkFontStyle::kNormal_Width,
+                                        oldStyle & SkTypeface::kItalic
+                                                 ? SkFontStyle::kItalic_Slant
+                                                 : SkFontStyle::kUpright_Slant);
 
         if (familyName) {
             // On Android, we must return NULL when we can't find the requested
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index dbc64b6..6fc1f28 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -373,13 +373,20 @@
     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(const SkFontStyle& style, bool fixedWidth, int index, SkStreamAsset* stream)
+    SkTypeface_stream(SkTypeface::Style style, bool fixedWidth, int ttcIndex, SkStreamAsset* stream)
         : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth)
         , fStream(SkRef(stream))
-        , fIndex(index)
+        , fIndex(ttcIndex)
     { };
 
     virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE {
@@ -440,7 +447,7 @@
 private:
     /** @param pattern takes ownership of the reference. */
     SkTypeface_fontconfig(FcPattern* pattern)
-        : INHERITED(skfontstyle_from_fcpattern(pattern),
+        : INHERITED(sktypefacestyle_from_fcpattern(pattern),
                     SkTypefaceCache::NewFontID(),
                     FC_PROPORTIONAL != get_int(pattern, FC_SPACING, FC_PROPORTIONAL))
         , fPattern(pattern)
@@ -564,7 +571,7 @@
                                           sizes.begin(), names.count());
     }
 
-    static bool FindByFcPattern(SkTypeface* cached, const SkFontStyle&, void* ctx) {
+    static bool FindByFcPattern(SkTypeface* cached, SkTypeface::Style, void* ctx) {
         SkTypeface_fontconfig* cshFace = static_cast<SkTypeface_fontconfig*>(cached);
         FcPattern* ctxPattern = static_cast<FcPattern*>(ctx);
         return FcTrue == FcPatternEqual(cshFace->fPattern, ctxPattern);
@@ -583,7 +590,7 @@
             FcPatternReference(pattern);
             face = SkTypeface_fontconfig::Create(pattern);
             if (face) {
-                fTFCache.add(face, SkFontStyle(), true);
+                fTFCache.add(face, SkTypeface::kNormal, true);
             }
         }
         return face;
@@ -811,7 +818,7 @@
             return NULL;
         }
 
-        SkFontStyle style;
+        SkTypeface::Style style = SkTypeface::kNormal;
         bool isFixedWidth = false;
         if (!SkTypeface_FreeType::ScanFont(stream, ttcIndex, NULL, &style, &isFixedWidth)) {
             return NULL;
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index e9d494f..ecca57f 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -331,7 +331,7 @@
     IDWriteFontFamily* fDWriteFontFamily;
 };
 
-static bool FindByDWriteFont(SkTypeface* cached, const SkFontStyle&, void* ctx) {
+static bool FindByDWriteFont(SkTypeface* cached, SkTypeface::Style, void* ctx) {
     DWriteFontTypeface* cshFace = reinterpret_cast<DWriteFontTypeface*>(cached);
     ProtoDWriteTypeface* ctxFace = reinterpret_cast<ProtoDWriteTypeface*>(ctx);
     bool same;
diff --git a/src/ports/SkTypeface_win_dw.h b/src/ports/SkTypeface_win_dw.h
index 7d72dfd..531dc51 100644
--- a/src/ports/SkTypeface_win_dw.h
+++ b/src/ports/SkTypeface_win_dw.h
@@ -24,19 +24,22 @@
 class SkFontDescriptor;
 struct SkScalerContextRec;
 
-static SkFontStyle get_style(IDWriteFont* font) {
-    DWRITE_FONT_STYLE dwStyle = font->GetStyle();
-    return SkFontStyle(font->GetWeight(),
-                       font->GetStretch(),
-                       (DWRITE_FONT_STYLE_OBLIQUE == dwStyle ||
-                        DWRITE_FONT_STYLE_ITALIC  == dwStyle)
-                                                   ? SkFontStyle::kItalic_Slant
-                                                   : SkFontStyle::kUpright_Slant);
+static SkTypeface::Style get_style(IDWriteFont* font) {
+    int style = SkTypeface::kNormal;
+    DWRITE_FONT_WEIGHT weight = font->GetWeight();
+    if (DWRITE_FONT_WEIGHT_DEMI_BOLD <= weight) {
+        style |= SkTypeface::kBold;
+    }
+    DWRITE_FONT_STYLE angle = font->GetStyle();
+    if (DWRITE_FONT_STYLE_OBLIQUE == angle || DWRITE_FONT_STYLE_ITALIC == angle) {
+        style |= SkTypeface::kItalic;
+    }
+    return static_cast<SkTypeface::Style>(style);
 }
 
 class DWriteFontTypeface : public SkTypeface {
 private:
-    DWriteFontTypeface(const SkFontStyle& style, SkFontID fontID,
+    DWriteFontTypeface(SkTypeface::Style style, SkFontID fontID,
                        IDWriteFactory* factory,
                        IDWriteFontFace* fontFace,
                        IDWriteFont* font,
@@ -77,8 +80,9 @@
                                       IDWriteFontFamily* fontFamily,
                                       IDWriteFontFileLoader* fontFileLoader = NULL,
                                       IDWriteFontCollectionLoader* fontCollectionLoader = NULL) {
+        SkTypeface::Style style = get_style(font);
         SkFontID fontID = SkTypefaceCache::NewFontID();
-        return SkNEW_ARGS(DWriteFontTypeface, (get_style(font), fontID,
+        return SkNEW_ARGS(DWriteFontTypeface, (style, fontID,
                                                factory, fontFace, font, fontFamily,
                                                fontFileLoader, fontCollectionLoader));
     }
diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp
index 7cee944..3236f07 100644
--- a/tools/sk_tool_utils_font.cpp
+++ b/tools/sk_tool_utils_font.cpp
@@ -63,7 +63,7 @@
             atexit(release_portable_typefaces);
         }
     }
-    return SkNEW_ARGS(SkTestTypeface, (font, SkFontStyle(style)));
+    return SkNEW_ARGS(SkTestTypeface, (font, style));
 }