Revert "Revert "onMatchFaceStyle is unused, so remove it""
This relands the idea that onMatchFaceStyle is no longer used, but
leaves the baseclass virtual to stage removing it from client
subclasses.
This reverts commit 3c04a65508
.
Change-Id: I18570065249c86f7f155c28288dce3ea9d59f619
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401759
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
e40b38ec0b
commit
b2497ddd0e
@ -137,8 +137,6 @@ protected:
|
||||
virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
|
||||
const char* bcp47[], int bcp47Count,
|
||||
SkUnichar character) const = 0;
|
||||
virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
|
||||
const SkFontStyle&) const = 0;
|
||||
|
||||
virtual sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const = 0;
|
||||
virtual sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
|
||||
@ -150,6 +148,12 @@ protected:
|
||||
|
||||
virtual sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle) const = 0;
|
||||
|
||||
// this method is never called -- will be removed
|
||||
virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
|
||||
const SkFontStyle&) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/** Implemented by porting layer to return the default factory. */
|
||||
|
@ -47,9 +47,6 @@ protected:
|
||||
int bcp47Count,
|
||||
SkUnichar character) const override;
|
||||
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
|
||||
const SkFontStyle& fontStyle) const override;
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>, int ttcIndex) const override;
|
||||
sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset> stream,
|
||||
const SkFontArguments& args) const override;
|
||||
|
@ -220,9 +220,6 @@ DEF_TEST(Skottie_Properties, reporter) {
|
||||
SkUnichar character) const override {
|
||||
return nullptr;
|
||||
}
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface*, const SkFontStyle&) const override {
|
||||
return nullptr;
|
||||
}
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override {
|
||||
return fTestFont;
|
||||
}
|
||||
@ -643,9 +640,6 @@ DEF_TEST(Skottie_Shaper_ExplicitFontMgr, reporter) {
|
||||
fFallbackCount++;
|
||||
return nullptr;
|
||||
}
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface*, const SkFontStyle&) const override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int) const override {
|
||||
return nullptr;
|
||||
|
@ -42,9 +42,6 @@ private:
|
||||
SkUnichar character) const override {
|
||||
return nullptr;
|
||||
}
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface*, const SkFontStyle&) const override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override {
|
||||
return nullptr;
|
||||
|
@ -53,9 +53,6 @@ public:
|
||||
SkUnichar) const override {
|
||||
return nullptr;
|
||||
}
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface*, const SkFontStyle&) const override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int) const override { return nullptr; }
|
||||
sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>, int) const override {
|
||||
|
@ -59,9 +59,6 @@ protected:
|
||||
SkUnichar character) const override {
|
||||
return nullptr;
|
||||
}
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface*, const SkFontStyle&) const override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int) const override {
|
||||
return nullptr;
|
||||
|
@ -150,13 +150,6 @@ SkTypeface* SkFontMgr_Indirect::onMatchFamilyStyleCharacter(const char familyNam
|
||||
return this->createTypefaceFromFontId(id);
|
||||
}
|
||||
|
||||
SkTypeface* SkFontMgr_Indirect::onMatchFaceStyle(const SkTypeface* familyMember,
|
||||
const SkFontStyle& fontStyle) const {
|
||||
SkString familyName;
|
||||
familyMember->getFamilyName(&familyName);
|
||||
return this->matchFamilyStyle(familyName.c_str(), fontStyle);
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> SkFontMgr_Indirect::onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset> stream,
|
||||
int ttcIndex) const {
|
||||
return fImpl->makeFromStream(std::move(stream), ttcIndex);
|
||||
|
@ -2271,14 +2271,6 @@ protected:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
|
||||
const SkFontStyle& fontstyle) const override {
|
||||
// could be in base impl
|
||||
SkString familyName;
|
||||
((LogFontTypeface*)familyMember)->getFamilyName(&familyName);
|
||||
return this->matchFamilyStyle(familyName.c_str(), fontstyle);
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset> stream,
|
||||
int ttcIndex) const override {
|
||||
if (ttcIndex != 0) {
|
||||
|
@ -216,10 +216,6 @@ protected:
|
||||
SK_ABORT("Not implemented.");
|
||||
}
|
||||
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface*, const SkFontStyle&) const override {
|
||||
SK_ABORT("Not implemented.");
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData> data, int ttcIndex) const override {
|
||||
return this->onMakeFromStreamIndex(SkMemoryStream::Make(std::move(data)), ttcIndex);
|
||||
}
|
||||
|
@ -358,18 +358,6 @@ protected:
|
||||
return sset->matchStyle(style);
|
||||
}
|
||||
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface* typeface,
|
||||
const SkFontStyle& style) const override {
|
||||
for (int i = 0; i < fStyleSets.count(); ++i) {
|
||||
for (int j = 0; j < fStyleSets[i]->fStyles.count(); ++j) {
|
||||
if (fStyleSets[i]->fStyles[j].get() == typeface) {
|
||||
return fStyleSets[i]->matchStyle(style);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static sk_sp<SkTypeface_AndroidSystem> find_family_style_character(
|
||||
const SkString& familyName,
|
||||
const SkTArray<NameToFamily, true>& fallbackNameToFamilyMap,
|
||||
|
@ -223,19 +223,6 @@ SkTypeface* SkFontMgr_Custom::onMatchFamilyStyleCharacter(const char familyName[
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkTypeface* SkFontMgr_Custom::onMatchFaceStyle(const SkTypeface* familyMember,
|
||||
const SkFontStyle& fontStyle) const
|
||||
{
|
||||
for (int i = 0; i < fFamilies.count(); ++i) {
|
||||
for (int j = 0; j < fFamilies[i]->fStyles.count(); ++j) {
|
||||
if (fFamilies[i]->fStyles[j].get() == familyMember) {
|
||||
return fFamilies[i]->matchStyle(fontStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> SkFontMgr_Custom::onMakeFromData(sk_sp<SkData> data, int ttcIndex) const {
|
||||
return this->makeFromStream(std::make_unique<SkMemoryStream>(std::move(data)), ttcIndex);
|
||||
}
|
||||
|
@ -145,8 +145,6 @@ protected:
|
||||
SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
|
||||
const char* bcp47[], int bcp47Count,
|
||||
SkUnichar character) const override;
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
|
||||
const SkFontStyle& fontStyle) const override;
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData> data, int ttcIndex) const override;
|
||||
sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>, int ttcIndex) const override;
|
||||
sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>, const SkFontArguments&) const override;
|
||||
|
@ -952,15 +952,6 @@ protected:
|
||||
return createTypefaceFromFcPattern(std::move(font)).release();
|
||||
}
|
||||
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface* typeface,
|
||||
const SkFontStyle& style) const override
|
||||
{
|
||||
//TODO: should the SkTypeface_fontconfig know its family?
|
||||
const SkTypeface_fontconfig* fcTypeface =
|
||||
static_cast<const SkTypeface_fontconfig*>(typeface);
|
||||
return this->matchFamilyStyle(get_string(fcTypeface->fPattern, FC_FAMILY), style);
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset> stream,
|
||||
int ttcIndex) const override {
|
||||
const size_t length = stream->getLength();
|
||||
|
@ -242,7 +242,6 @@ protected:
|
||||
SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
|
||||
const char* bcp47[], int bcp47Count,
|
||||
SkUnichar character) const override;
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface*, const SkFontStyle&) const override;
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override;
|
||||
sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
|
||||
int ttcIndex) const override;
|
||||
@ -370,10 +369,6 @@ SkTypeface* SkFontMgr_Fuchsia::onMatchFamilyStyleCharacter(const char familyName
|
||||
return typeface.release();
|
||||
}
|
||||
|
||||
SkTypeface* SkFontMgr_Fuchsia::onMatchFaceStyle(const SkTypeface*, const SkFontStyle&) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> SkFontMgr_Fuchsia::onMakeFromData(sk_sp<SkData>, int ttcIndex) const {
|
||||
SkASSERT(false);
|
||||
return nullptr;
|
||||
|
@ -557,11 +557,6 @@ protected:
|
||||
return SkTypeface_Mac::Make(std::move(fallbackFont), OpszVariation(), nullptr).release();
|
||||
}
|
||||
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
|
||||
const SkFontStyle&) const override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData> data, int ttcIndex) const override {
|
||||
if (ttcIndex != 0) {
|
||||
return nullptr;
|
||||
|
@ -292,8 +292,6 @@ protected:
|
||||
SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
|
||||
const char* bcp47[], int bcp47Count,
|
||||
SkUnichar character) const override;
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
|
||||
const SkFontStyle& fontstyle) const override;
|
||||
sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>, int ttcIndex) const override;
|
||||
sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>, const SkFontArguments&) const override;
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override;
|
||||
@ -874,15 +872,6 @@ sk_sp<SkTypeface> SkFontMgr_DirectWrite::layoutFallback(const WCHAR* dwFamilyNam
|
||||
return fontFallbackRenderer->ConsumeFallbackTypeface();
|
||||
}
|
||||
|
||||
SkTypeface* SkFontMgr_DirectWrite::onMatchFaceStyle(const SkTypeface* familyMember,
|
||||
const SkFontStyle& fontstyle) const {
|
||||
SkString familyName;
|
||||
SkFontStyleSet_DirectWrite sset(
|
||||
this, ((DWriteFontTypeface*)familyMember)->fDWriteFontFamily.get()
|
||||
);
|
||||
return sset.matchStyle(fontstyle);
|
||||
}
|
||||
|
||||
template <typename T> class SkAutoIDWriteUnregister {
|
||||
public:
|
||||
SkAutoIDWriteUnregister(IDWriteFactory* factory, T* unregister)
|
||||
|
@ -157,12 +157,6 @@ public:
|
||||
return this->matchFamilyStyle(familyName, style);
|
||||
}
|
||||
|
||||
SkTypeface* onMatchFaceStyle(const SkTypeface* tf, const SkFontStyle& style) const override {
|
||||
SkString familyName;
|
||||
tf->getFamilyName(&familyName);
|
||||
return this->matchFamilyStyle(familyName.c_str(), style);
|
||||
}
|
||||
|
||||
sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override { return nullptr; }
|
||||
sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
|
||||
int ttcIndex) const override {
|
||||
|
Loading…
Reference in New Issue
Block a user