| Index: src/core/SkTypeface.cpp
|
| diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
|
| index d7da131d13b2db7786efafc33221133eb927aa6d..f9487870ccc537ad13e669083ab9022f554b6151 100644
|
| --- a/src/core/SkTypeface.cpp
|
| +++ b/src/core/SkTypeface.cpp
|
| @@ -132,10 +132,15 @@ SkTypeface* SkTypeface::CreateFromName(const char name[], Style style) {
|
| }
|
|
|
| SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) {
|
| - if (family && family->style() == s) {
|
| + if (!family) {
|
| + return SkTypeface::RefDefault(s);
|
| + }
|
| +
|
| + if (family->style() == s) {
|
| family->ref();
|
| return const_cast<SkTypeface*>(family);
|
| }
|
| +
|
| SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
|
| bool bold = s & SkTypeface::kBold;
|
| bool italic = s & SkTypeface::kItalic;
|
| @@ -143,7 +148,7 @@ SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) {
|
| : SkFontStyle::kNormal_Weight,
|
| SkFontStyle::kNormal_Width,
|
| italic ? SkFontStyle::kItalic_Slant
|
| - : SkFontStyle::kUpright_Slant);
|
| + : SkFontStyle::kUpright_Slant);
|
| return fm->matchFaceStyle(family, newStyle);
|
| }
|
|
|
|
|