Index: trunk/src/ports/SkFontHost_linux.cpp |
=================================================================== |
--- trunk/src/ports/SkFontHost_linux.cpp (revision 8339) |
+++ trunk/src/ports/SkFontHost_linux.cpp (working copy) |
@@ -258,8 +258,7 @@ |
bool isSysFont() const { return fIsSysFont; } |
FamilyRec* getFamily() const { return fFamilyRec; } |
- // openStream returns a SkStream that has been ref-ed |
- virtual SkStream* openStream() = 0; |
+ |
virtual const char* getUniqueString() const = 0; |
private: |
@@ -279,10 +278,11 @@ |
public: |
EmptyTypeface() : INHERITED(SkTypeface::kNormal, true, NULL, false) {} |
- // overrides |
- virtual SkStream* openStream() SK_OVERRIDE { return NULL; } |
virtual const char* getUniqueString() SK_OVERRIDE const { return NULL; } |
+protected: |
+ virtual SkStream* onOpenStream(int*) const SK_OVERRIDE { return NULL; } |
+ |
private: |
typedef FamilyTypeface INHERITED; |
}; |
@@ -299,13 +299,15 @@ |
fStream->unref(); |
} |
- virtual SkStream* openStream() SK_OVERRIDE { |
- // openStream returns a refed stream. |
- fStream->ref(); |
- return fStream; |
- } |
virtual const char* getUniqueString() const SK_OVERRIDE { return NULL; } |
+protected: |
+ virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE { |
+ *ttcIndex = 0; |
+ fStream->ref(); |
+ return fStream; |
+ } |
+ |
private: |
SkStream* fStream; |
@@ -320,10 +322,6 @@ |
fPath.set(path); |
} |
- virtual SkStream* openStream() SK_OVERRIDE { |
- return SkStream::NewFromFile(fPath.c_str()); |
- } |
- |
virtual const char* getUniqueString() const SK_OVERRIDE { |
const char* str = strrchr(fPath.c_str(), '/'); |
if (str) { |
@@ -332,6 +330,12 @@ |
return str; |
} |
+protected: |
+ virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE { |
+ *ttcIndex = 0; |
+ return SkStream::NewFromFile(fPath.c_str()); |
+ } |
+ |
private: |
SkString fPath; |
@@ -465,7 +469,7 @@ |
const bool isCustomFont = !((FamilyTypeface*)face)->isSysFont(); |
if (isCustomFont) { |
// store the entire font in the fontData |
- SkStream* fontStream = ((FamilyTypeface*)face)->openStream(); |
+ SkStream* fontStream = face->openStream(NULL); |
const uint32_t length = fontStream->getLength(); |
stream->writePackedUInt(length); |
@@ -529,17 +533,6 @@ |
return tf; |
} |
-SkStream* SkFontHost::OpenStream(uint32_t fontID) { |
- FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID); |
- SkStream* stream = tf ? tf->openStream() : NULL; |
- |
- if (stream && stream->getLength() == 0) { |
- stream->unref(); |
- stream = NULL; |
- } |
- return stream; |
-} |
- |
SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) { |
return NULL; |
} |