Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SkOrderedFontMgr::onMatchFamily #193

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/utils/SkOrderedFontMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ sk_sp<SkFontStyleSet> SkOrderedFontMgr::onCreateStyleSet(int index) const {

sk_sp<SkFontStyleSet> SkOrderedFontMgr::onMatchFamily(const char familyName[]) const {
for (const auto& fm : fList) {
if (auto fs = fm->matchFamily(familyName)) {
const auto fs = fm->matchFamily(familyName);
if (fs->count() > 0){
return fs;
}
}
Expand Down Expand Up @@ -85,6 +86,15 @@ sk_sp<SkTypeface> SkOrderedFontMgr::onMatchFamilyStyleCharacter(
return nullptr;
}

sk_sp<SkTypeface> SkOrderedFontMgr::onLegacyMakeTypeface(const char family[], SkFontStyle style) const {
for (const auto& fm : fList) {
if (auto tf = fm->matchFamilyStyle(family, style)) {
return fm->legacyMakeTypeface(family, style);
}
}
return nullptr;
}

// All of these are defined to fail by returning null

sk_sp<SkTypeface> SkOrderedFontMgr::onMakeFromData(sk_sp<SkData>, int ttcIndex) const {
Expand All @@ -104,7 +114,3 @@ sk_sp<SkTypeface> SkOrderedFontMgr::onMakeFromStreamArgs(std::unique_ptr<SkStrea
sk_sp<SkTypeface> SkOrderedFontMgr::onMakeFromFile(const char path[], int ttcIndex) const {
return nullptr;
}

sk_sp<SkTypeface> SkOrderedFontMgr::onLegacyMakeTypeface(const char family[], SkFontStyle) const {
return nullptr;
}