diff options
author | bungeman <bungeman@google.com> | 2017-05-01 13:02:42 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-01 18:13:02 +0000 |
commit | 7575bb1c389f96db4123783fcd717f3611b3a8eb (patch) | |
tree | ba76ce96b732117155b6fc48c644e9e29f50cd85 /src/ports/SkFontHost_mac.cpp | |
parent | fe560a8cc3839b7c4c0a63bdb286fe1e1f89a5dc (diff) |
SkFontMgr::matchFamily should not crash on nullptr.
While all systems can resolve a font from just a style request
(without a name) almost no systems specify a default font family.
BUG=skia:6574
Change-Id: If7c81808b62cd5d8212bce2eb4d9c476c45af80a
Reviewed-on: https://skia-review.googlesource.com/14902
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src/ports/SkFontHost_mac.cpp')
-rw-r--r-- | src/ports/SkFontHost_mac.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index b525ed597f..4774eab87f 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -2362,14 +2362,17 @@ protected: } SkFontStyleSet* onMatchFamily(const char familyName[]) const override { + if (!familyName) { + return nullptr; + } UniqueCFRef<CFStringRef> cfName = make_CFString(familyName); return CreateSet(cfName.get()); } SkTypeface* onMatchFamilyStyle(const char familyName[], - const SkFontStyle& fontStyle) const override { - sk_sp<SkFontStyleSet> sset(this->matchFamily(familyName)); - return sset->matchStyle(fontStyle); + const SkFontStyle& style) const override { + UniqueCFRef<CTFontDescriptorRef> desc = create_descriptor(familyName, style); + return create_from_desc(desc.get()); } SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], |