diff --git a/src/ports/skia_ohos/SkFontMgr_ohos.cpp b/src/ports/skia_ohos/SkFontMgr_ohos.cpp index f83cf797848d94813faae7c587732bbb402ccb42..373f9403efb68e3a6ae6645bab680d05a9dee70b 100755 --- a/src/ports/skia_ohos/SkFontMgr_ohos.cpp +++ b/src/ports/skia_ohos/SkFontMgr_ohos.cpp @@ -371,9 +371,9 @@ sk_sp SkFontMgr_OHOS::onMakeFromFile(const char path[], int ttcIndex sk_sp SkFontMgr_OHOS::onLegacyMakeTypeface(const char familyName[], SkFontStyle style) const { SkTypeface* typeface = this->onMatchFamilyStyle(familyName, style); - - std::string str = !familyName ? "" : familyName; - if (str == "") { + + // if familyName is not found, then try the default family + if (typeface == nullptr && familyName != nullptr) { typeface = this->onMatchFamilyStyle(nullptr, style); }