Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Unified Diff: src/ports/SkFontHost_win.cpp

Issue 12941006: override SkTypeface::onOpenStream() (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_win.cpp
===================================================================
--- src/ports/SkFontHost_win.cpp (revision 8304)
+++ src/ports/SkFontHost_win.cpp (working copy)
@@ -210,6 +210,7 @@
}
protected:
+ virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE;
virtual SkScalerContext* onCreateScalerContext(const SkDescriptor*) const SK_OVERRIDE;
virtual void onFilterRec(SkScalerContextRec*) const SK_OVERRIDE;
virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
@@ -1321,11 +1322,14 @@
if (face->fSerializeAsStream) {
// store the entire font in the fontData
- SkAutoTUnref<SkStream> fontStream(SkFontHost::OpenStream(face->uniqueID()));
- const uint32_t length = fontStream->getLength();
-
- stream->writePackedUInt(length);
- stream->writeStream(fontStream, length);
+ SkAutoTUnref<SkStream> fontStream(face->openStream(NULL));
+ if (fontStream.get()) {
+ const uint32_t length = fontStream->getLength();
+ stream->writePackedUInt(length);
+ stream->writeStream(fontStream, length);
+ } else {
+ stream->writePackedUInt(0);
+ }
} else {
stream->writePackedUInt(0);
}
@@ -1588,11 +1592,12 @@
return SkCreateFontMemResourceTypefaceFromLOGFONT(lf, fontReference);
}
-SkStream* SkFontHost::OpenStream(SkFontID uniqueID) {
+SkStream* LogFontTypeface::onOpenStream(int* ttcIndex) const {
+ *ttcIndex = 0;
+
const DWORD kTTCTag =
SkEndian_SwapBE32(SkSetFourByteTag('t', 't', 'c', 'f'));
- LOGFONT lf;
- GetLogFontByID(uniqueID, &lf);
+ LOGFONT lf = fLogFont;
HDC hdc = ::CreateCompatibleDC(NULL);
HFONT font = CreateFontIndirect(&lf);
@@ -1625,7 +1630,13 @@
return stream;
}
+SkStream* SkFontHost::OpenStream(SkFontID uniqueID) {
+ SkTypeface* typeface = SkTypefaceCache::FindByID(uniqueID);
+ return typeface ? typeface->openStream(NULL) : NULL;
+}
+
size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, int32_t* index) {
+ SkASSERT(!"SkFontHost::GetFileName is DEPRECATED\n");
return 0;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698