remove SkFontHost::NextLogicalFont, and add android-specific function

SkAndroidNextLogicalTypeface



git-svn-id: http://skia.googlecode.com/svn/trunk@8386 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2013-03-26 12:29:05 +00:00
Родитель 02c77648ce
Коммит 1fa793fa6b
10 изменённых файлов: 25 добавлений и 64 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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.

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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);
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -27,7 +27,3 @@ SkTypeface* SkFontHost::CreateTypefaceFromFile(char const*) {
return NULL;
}
SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID,
SkFontID origFontID) {
return NULL;
}

Просмотреть файл

@ -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<LogFontTypeface*>(SkTypefaceCache::FindByID(fontID));
if (face) {

Просмотреть файл

@ -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 {