From febfd70d26dce3eb30da5384e36d740576a56161 Mon Sep 17 00:00:00 2001 From: "bungeman@google.com" Date: Fri, 2 Aug 2013 00:20:34 +0000 Subject: Add onRefMatchingStyle to SkFontHost_linux. git-svn-id: http://skia.googlecode.com/svn/trunk@10502 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/ports/SkFontHost_linux.cpp | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/ports/SkFontHost_linux.cpp b/src/ports/SkFontHost_linux.cpp index 71438986e6..2487976b86 100644 --- a/src/ports/SkFontHost_linux.cpp +++ b/src/ports/SkFontHost_linux.cpp @@ -113,20 +113,6 @@ static FamilyRec* find_family(const SkTypeface* member) { return NULL; } -static SkTypeface* find_from_uniqueID(uint32_t uniqueID) { - FamilyRec* curr = gFamilyHead; - while (curr != NULL) { - for (int i = 0; i < 4; i++) { - SkTypeface* face = curr->fFaces[i]; - if (face != NULL && face->uniqueID() == uniqueID) { - return face; - } - } - curr = curr->fNext; - } - return NULL; -} - /* Remove reference to this face from its family. If the resulting family is empty (has no faces), return that family, otherwise return NULL */ @@ -263,6 +249,7 @@ public: protected: virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE; + virtual SkTypeface* onRefMatchingStyle(Style styleBits) const SK_OVERRIDE; private: FamilyRec* fFamilyRec; // we don't own this, just point to it @@ -467,13 +454,9 @@ void FamilyTypeface::onGetFontDescriptor(SkFontDescriptor* desc, *isLocalStream = !this->isSysFont(); } -/////////////////////////////////////////////////////////////////////////////// - -#ifndef SK_FONTHOST_USES_FONTMGR - -SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, - const char familyName[], - SkTypeface::Style style) { +static SkTypeface* create_typeface(const SkTypeface* familyFace, + const char familyName[], + SkTypeface::Style style) { load_system_fonts(); SkAutoMutexAcquire ac(gFamilyMutex); @@ -498,6 +481,20 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, return tf; } +SkTypeface* FamilyTypeface::onRefMatchingStyle(Style style) const { + return create_typeface(this, NULL, style); +} + +/////////////////////////////////////////////////////////////////////////////// + +#ifndef SK_FONTHOST_USES_FONTMGR + +SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, + const char familyName[], + SkTypeface::Style style) { + return create_typeface(familyFace, NULL, style); +} + SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { if (NULL == stream || stream->getLength() <= 0) { SkDELETE(stream); -- cgit v1.2.3