Index: src/ports/SkFontHost_fontconfig.cpp |
diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp |
index e42929a264496ce216f72e5b3a453c18af8f95e0..207aa7232309d0a0da35cee6b1a27e8ae6d01eb1 100644 |
--- a/src/ports/SkFontHost_fontconfig.cpp |
+++ b/src/ports/SkFontHost_fontconfig.cpp |
@@ -166,9 +166,16 @@ public: |
} |
}; |
+#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; |
@@ -176,7 +183,6 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyN |
// Check if this request is already in the request cache. |
using Request = SkFontHostRequestCache::Request; |
- SkFontStyle requestedStyle(requestedOldStyle); |
SkAutoTDelete<Request> request(Request::Create(requestedFamilyName, requestedStyle)); |
SkTypeface* face = SkFontHostRequestCache::FindAndRef(request); |
if (face) { |
@@ -185,9 +191,14 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyN |
SkFontConfigInterface::FontIdentity identity; |
SkString outFamilyName; |
- SkTypeface::Style outOldStyle; |
+#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE |
+ SkTypeface::Style outStyle; |
if (!fci->matchFamilyName(requestedFamilyName, requestedOldStyle, |
- &identity, &outFamilyName, &outOldStyle)) |
+#else |
+ SkFontStyle outStyle; |
+ if (!fci->matchFamilyName(requestedFamilyName, requestedStyle, |
+#endif |
+ &identity, &outFamilyName, &outStyle)) |
{ |
return nullptr; |
} |
@@ -195,9 +206,15 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(const char requestedFamilyN |
// Check if a typeface with this FontIdentity is already in the FontIdentity cache. |
face = SkTypefaceCache::FindByProcAndRef(find_by_FontIdentity, &identity); |
if (!face) { |
- face = FontConfigTypeface::Create(SkFontStyle(outOldStyle), identity, outFamilyName); |
+#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, SkFontStyle(outOldStyle)); |
+ SkTypefaceCache::Add(face, outStyle); |
+#endif |
} |
// Add this request to the request cache. |
SkFontHostRequestCache::Add(face, request.release()); |