Remove SK_VERY_LEGACY_CREATE_TYPEFACE.
The flag and code it guards are no longer used.
TBR=reed
This just removes dead code.
Review URL: https://codereview.chromium.org/1882803002
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp
index 1c42e2d..cc80fbe 100644
--- a/src/ports/SkFontConfigInterface_direct.cpp
+++ b/src/ports/SkFontConfigInterface_direct.cpp
@@ -305,40 +305,6 @@
}
// Retrieves |is_bold|, |is_italic| and |font_family| properties from |font|.
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-SkTypeface::Style GetFontStyle(FcPattern* font) {
- int resulting_bold;
- if (FcPatternGetInteger(font, FC_WEIGHT, 0, &resulting_bold))
- resulting_bold = FC_WEIGHT_NORMAL;
-
- int resulting_italic;
- if (FcPatternGetInteger(font, FC_SLANT, 0, &resulting_italic))
- resulting_italic = FC_SLANT_ROMAN;
-
- // If we ask for an italic font, fontconfig might take a roman font and set
- // the undocumented property FC_MATRIX to a skew matrix. It'll then say
- // that the font is italic or oblique. So, if we see a matrix, we don't
- // believe that it's italic.
- FcValue matrix;
- const bool have_matrix = FcPatternGet(font, FC_MATRIX, 0, &matrix) == 0;
-
- // If we ask for an italic font, fontconfig might take a roman font and set
- // FC_EMBOLDEN.
- FcValue embolden;
- const bool have_embolden = FcPatternGet(font, FC_EMBOLDEN, 0, &embolden) == 0;
-
- int styleBits = 0;
- if (resulting_bold > FC_WEIGHT_MEDIUM && !have_embolden) {
- styleBits |= SkTypeface::kBold;
- }
- if (resulting_italic > FC_SLANT_ROMAN && !have_matrix) {
- styleBits |= SkTypeface::kItalic;
- }
-
- return (SkTypeface::Style)styleBits;
-}
-#else
-
static int get_int(FcPattern* pattern, const char object[], int missing) {
int value;
if (FcPatternGetInteger(pattern, object, 0, &value) != FcResultMatch) {
@@ -463,11 +429,6 @@
FcPatternAddInteger(pattern, FC_SLANT, style.isItalic() ? FC_SLANT_ITALIC : FC_SLANT_ROMAN);
}
-SkFontStyle GetFontStyle(FcPattern* font) {
- return skfontstyle_from_fcpattern(font);
-}
-#endif
-
} // anonymous namespace
///////////////////////////////////////////////////////////////////////////////
@@ -549,19 +510,11 @@
return match;
}
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[],
- SkTypeface::Style style,
- FontIdentity* outIdentity,
- SkString* outFamilyName,
- SkTypeface::Style* outStyle) {
-#else
bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[],
SkFontStyle style,
FontIdentity* outIdentity,
SkString* outFamilyName,
SkFontStyle* outStyle) {
-#endif
SkString familyStr(familyName ? familyName : "");
if (familyStr.size() > kMaxFontFamilyLength) {
return false;
@@ -574,16 +527,7 @@
if (familyName) {
FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)familyName);
}
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- FcPatternAddInteger(pattern, FC_WEIGHT,
- (style & SkTypeface::kBold) ? FC_WEIGHT_BOLD
- : FC_WEIGHT_NORMAL);
- FcPatternAddInteger(pattern, FC_SLANT,
- (style & SkTypeface::kItalic) ? FC_SLANT_ITALIC
- : FC_SLANT_ROMAN);
-#else
fcpattern_from_skfontstyle(style, pattern);
-#endif
FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);
@@ -671,7 +615,7 @@
outFamilyName->set(post_config_family);
}
if (outStyle) {
- *outStyle = GetFontStyle(match);
+ *outStyle = skfontstyle_from_fcpattern(match);
}
return true;
}
diff --git a/src/ports/SkFontConfigInterface_direct.h b/src/ports/SkFontConfigInterface_direct.h
index 22dd9f1..3f0af82 100644
--- a/src/ports/SkFontConfigInterface_direct.h
+++ b/src/ports/SkFontConfigInterface_direct.h
@@ -17,20 +17,12 @@
SkFontConfigInterfaceDirect();
~SkFontConfigInterfaceDirect() override;
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- bool matchFamilyName(const char familyName[],
- SkTypeface::Style requested,
- FontIdentity* outFontIdentifier,
- SkString* outFamilyName,
- SkTypeface::Style* outStyle) override;
-#else
bool matchFamilyName(const char familyName[],
SkFontStyle requested,
FontIdentity* outFontIdentifier,
SkString* outFamilyName,
SkFontStyle* outStyle) override;
-#endif
SkStreamAsset* openStream(const FontIdentity&) override;
// new APIs
diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h
index 68a36e3..00e00cf 100644
--- a/src/ports/SkFontConfigTypeface.h
+++ b/src/ports/SkFontConfigTypeface.h
@@ -39,11 +39,7 @@
return fFamilyName.equals(name);
}
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- static SkTypeface* LegacyCreateTypeface(const char familyName[], SkTypeface::Style);
-#else
static SkTypeface* LegacyCreateTypeface(const char familyName[], SkFontStyle);
-#endif
protected:
FontConfigTypeface(const SkFontStyle& style,
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
index 207aa72..0ed8d8f 100644
--- a/src/ports/SkFontHost_fontconfig.cpp
+++ b/src/ports/SkFontHost_fontconfig.cpp
@@ -166,16 +166,9 @@
}
};
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyName[],
- SkTypeface::Style requestedOldStyle)
-{
- SkFontStyle requestedStyle = SkFontStyle::FromOldStyle(requestedOldStyle);
-#else
SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyName[],
SkFontStyle requestedStyle)
{
-#endif
SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
if (nullptr == fci.get()) {
return nullptr;
@@ -191,13 +184,8 @@
SkFontConfigInterface::FontIdentity identity;
SkString outFamilyName;
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- SkTypeface::Style outStyle;
- if (!fci->matchFamilyName(requestedFamilyName, requestedOldStyle,
-#else
SkFontStyle outStyle;
if (!fci->matchFamilyName(requestedFamilyName, requestedStyle,
-#endif
&identity, &outFamilyName, &outStyle))
{
return nullptr;
@@ -206,15 +194,9 @@
// Check if a typeface with this FontIdentity is already in the FontIdentity cache.
face = SkTypefaceCache::FindByProcAndRef(find_by_FontIdentity, &identity);
if (!face) {
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- face = FontConfigTypeface::Create(SkFontStyle::FromOldStyle(outStyle), identity, outFamilyName);
- // Add this FontIdentity to the FontIdentity cache.
- SkTypefaceCache::Add(face, SkFontStyle::FromOldStyle(outStyle));
-#else
face = FontConfigTypeface::Create(outStyle, identity, outFamilyName);
// Add this FontIdentity to the FontIdentity cache.
SkTypefaceCache::Add(face, outStyle);
-#endif
}
// Add this request to the request cache.
SkFontHostRequestCache::Add(face, request.release());
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 70693ee..049d08b 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -2559,12 +2559,7 @@
return create_from_dataProvider(pr);
}
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
- SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
if (familyName) {
familyName = map_css_names(familyName);
}
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 9ded4f5..c9781ba 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -2501,12 +2501,7 @@
return this->createFromStream(SkStream::NewFromFile(path));
}
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
- SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
LOGFONT lf;
if (nullptr == familyName) {
lf = get_default_font();
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 741d6cc..ed5a4d5 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -487,12 +487,7 @@
return new SkTypeface_AndroidStream(data, style, isFixedPitch, name);
}
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
- SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
if (familyName) {
// On Android, we must return nullptr when we can't find the requested
// named typeface so that the system/app can provide their own recovery
diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp
index 6749ced..20d6f78 100644
--- a/src/ports/SkFontMgr_custom.cpp
+++ b/src/ports/SkFontMgr_custom.cpp
@@ -308,12 +308,7 @@
return stream.get() ? this->createFromStream(stream.release(), ttcIndex) : nullptr;
}
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
- SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
SkTypeface* tf = nullptr;
if (familyName) {
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index c8b055f..393265c 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -874,12 +874,7 @@
return new SkTypeface_stream(fontData, style, isFixedWidth);
}
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
- SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
-#endif
SkAutoTUnref<SkTypeface> typeface(this->matchFamilyStyle(familyName, style));
if (typeface.get()) {
return typeface.release();
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index 788bb5e..a03fcf8 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -294,11 +294,7 @@
SkTypeface* onCreateFromStream(SkStreamAsset* stream, int ttcIndex) const override;
SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override;
SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override;
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
- SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override;
-#else
SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle) const override;
-#endif
private:
HRESULT getByFamilyName(const WCHAR familyName[], IDWriteFontFamily** fontFamily) const;
@@ -953,14 +949,8 @@
return S_OK;
}
-#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
-SkTypeface* SkFontMgr_DirectWrite::onLegacyCreateTypeface(const char familyName[],
- unsigned styleBits) const {
- SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
-#else
SkTypeface* SkFontMgr_DirectWrite::onLegacyCreateTypeface(const char familyName[],
SkFontStyle style) const {
-#endif
SkTScopedComPtr<IDWriteFontFamily> fontFamily;
if (familyName) {
SkSMallocWCHAR wideFamilyName;