diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h index 317923f34..4c5013fe4 100644 --- a/include/core/SkFontHost.h +++ b/include/core/SkFontHost.h @@ -92,26 +92,6 @@ public: static LCDOrder GetSubpixelOrder(); private: - - /** - * DEPRECATED -- will be DESTROYED - * - * Given a "current" fontID, return a ref to the next logical typeface - * when searching fonts for a given unicode value. Typically the caller - * will query a given font, and if a unicode value is not supported, they - * will call this, and if 0 is not returned, will search that font, and so - * on. This process must be finite, and when the fonthost sees a - * font with no logical successor, it must return NULL. - * - * The original fontID is also provided. This is the initial font that was - * stored in the typeface of the caller. It is provided as an aid to choose - * the best next logical font. e.g. If the original font was bold or serif, - * but the 2nd in the logical chain was plain, then a subsequent call to - * get the 3rd can still inspect the original, and try to match its - * stylistic attributes. - */ - static SkTypeface* NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID); - /** Return a new, closest matching typeface given either an existing family (specified by a typeface in that family) or by a familyName and a requested style. diff --git a/include/ports/SkTypeface_android.h b/include/ports/SkTypeface_android.h index 1ee17e6ea..eb0cd2525 100644 --- a/include/ports/SkTypeface_android.h +++ b/include/ports/SkTypeface_android.h @@ -78,4 +78,22 @@ SK_API bool SkGetFallbackFamilyNameForChar(SkUnichar uni, SkString* name); SK_API void SkUseTestFontConfigFile(const char* mainconf, const char* fallbackconf, const char* fontsdir); +/** + * Given a "current" fontID, return a ref to the next logical typeface + * when searching fonts for a given unicode value. Typically the caller + * will query a given font, and if a unicode value is not supported, they + * will call this, and if 0 is not returned, will search that font, and so + * on. This process must be finite, and when the fonthost sees a + * font with no logical successor, it must return NULL. + * + * The original fontID is also provided. This is the initial font that was + * stored in the typeface of the caller. It is provided as an aid to choose + * the best next logical font. e.g. If the original font was bold or serif, + * but the 2nd in the logical chain was plain, then a subsequent call to + * get the 3rd can still inspect the original, and try to match its + * stylistic attributes. + */ +static SkTypeface* SkAndroidNextLogicalTypeface(SkFontID currFontID, + SkFontID origFontID); + #endif diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index 98b5a7a43..c02dbca93 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -22,6 +22,9 @@ #include "SkStroke.h" #include "SkThread.h" +#ifdef SK_BUILD_FOR_ANDROID + #include "SkTypeface_android.h" +#endif #define ComputeBWRowBytes(width) (((unsigned)(width) + 7) >> 3) @@ -121,8 +124,8 @@ SkScalerContext::~SkScalerContext() { // there are no more entries in the fallback chain. SkScalerContext* SkScalerContext::allocNextContext() const { #ifdef SK_BUILD_FOR_ANDROID - SkTypeface* newFace = SkFontHost::NextLogicalTypeface(fRec.fFontID, - fRec.fOrigFontID); + SkTypeface* newFace = SkAndroidNextLogicalTypeface(fRec.fFontID, + fRec.fOrigFontID); if (0 == newFace) { return NULL; } diff --git a/src/ports/SkFontHost_android.cpp b/src/ports/SkFontHost_android.cpp index 1dc570989..d1bd9929f 100644 --- a/src/ports/SkFontHost_android.cpp +++ b/src/ports/SkFontHost_android.cpp @@ -801,7 +801,8 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, return tf; } -SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) { +SkTypeface* SkAndroidNextLogicalTypeface(SkFontID currFontID, + SkFontID origFontID) { #if defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) // Skia does not support font fallback for ndk applications in order to // enable clients such as WebKit to customize their font selection. diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp index 4955057b5..f66be28fd 100644 --- a/src/ports/SkFontHost_fontconfig.cpp +++ b/src/ports/SkFontHost_fontconfig.cpp @@ -175,14 +175,6 @@ SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) { /////////////////////////////////////////////////////////////////////////////// -// DEPRECATED -SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID curr, SkFontID orig) { - // We don't handle font fallback. - return NULL; -} - -/////////////////////////////////////////////////////////////////////////////// - SkStream* FontConfigTypeface::onOpenStream(int* ttcIndex) const { SkStream* stream = this->getLocalStream(); if (stream) { diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp index 3fdcf9833..0ddcdb767 100644 --- a/src/ports/SkFontHost_linux.cpp +++ b/src/ports/SkFontHost_linux.cpp @@ -496,10 +496,6 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, return tf; } -SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) { - return NULL; -} - /////////////////////////////////////////////////////////////////////////////// SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index ec8aafd75..f67b9f9c2 100755 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -1681,17 +1681,6 @@ SkStream* SkTypeface_Mac::onOpenStream(int* ttcIndex) const { return stream; } -/////////////////////////////////////////////////////////////////////////////// - -// DEPRECATED -SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) { - SkTypeface* face = GetDefaultFace(); - if (face->uniqueID() == currFontID) { - face = NULL; - } - return SkSafeRef(face); -} - /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/src/ports/SkFontHost_none.cpp b/src/ports/SkFontHost_none.cpp index e7b3f8a79..6abb75db9 100644 --- a/src/ports/SkFontHost_none.cpp +++ b/src/ports/SkFontHost_none.cpp @@ -27,7 +27,3 @@ SkTypeface* SkFontHost::CreateTypefaceFromFile(char const*) { return NULL; } -SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, - SkFontID origFontID) { - return NULL; -} diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 3c585e882..0261b2b84 100755 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -304,13 +304,6 @@ void SkLOGFONTFromTypeface(const SkTypeface* face, LOGFONT* lf) { } } -SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) { - // Zero means that we don't have any fallback fonts for this fontID. - // This function is implemented on Android, but doesn't have much - // meaning here. - return NULL; -} - static void GetLogFontByID(SkFontID fontID, LOGFONT* lf) { LogFontTypeface* face = static_cast(SkTypefaceCache::FindByID(fontID)); if (face) { diff --git a/src/ports/SkFontHost_win_dw.cpp b/src/ports/SkFontHost_win_dw.cpp index 32a06d7e5..8debc31f8 100644 --- a/src/ports/SkFontHost_win_dw.cpp +++ b/src/ports/SkFontHost_win_dw.cpp @@ -41,13 +41,6 @@ static bool isLCD(const SkScalerContext::Rec& rec) { SkMask::kLCD32_Format == rec.fMaskFormat; } -SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) { - // Zero means that we don't have any fallback fonts for this fontID. - // This function is implemented on Android, but doesn't have much - // meaning here. - return NULL; -} - /////////////////////////////////////////////////////////////////////////////// class DWriteOffscreen {