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

Unified Diff: trunk/src/core/SkTypeface.cpp

Issue 13001002: remove GetTable* APIs from SkFontHost, and rely on SkTypeface::onGetTable* (Closed) Base URL: http://skia.googlecode.com/svn/
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 | « trunk/include/core/SkFontHost.h ('k') | trunk/src/ports/SkFontHost_fontconfig.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/core/SkTypeface.cpp
===================================================================
--- trunk/src/core/SkTypeface.cpp (revision 8303)
+++ trunk/src/core/SkTypeface.cpp (working copy)
@@ -106,20 +106,20 @@
///////////////////////////////////////////////////////////////////////////////
int SkTypeface::countTables() const {
- return SkFontHost::CountTables(fUniqueID);
+ return this->onGetTableTags(NULL);
}
int SkTypeface::getTableTags(SkFontTableTag tags[]) const {
- return SkFontHost::GetTableTags(fUniqueID, tags);
+ return this->onGetTableTags(tags);
}
size_t SkTypeface::getTableSize(SkFontTableTag tag) const {
- return SkFontHost::GetTableSize(fUniqueID, tag);
+ return this->onGetTableData(tag, 0, ~0U, NULL);
}
size_t SkTypeface::getTableData(SkFontTableTag tag, size_t offset, size_t length,
void* data) const {
- return SkFontHost::GetTableData(fUniqueID, tag, offset, length, data);
+ return this->onGetTableData(tag, offset, length, data);
}
SkStream* SkTypeface::openStream(int* ttcIndex) const {
@@ -164,10 +164,25 @@
return SkFontHost::OpenStream(fUniqueID);
}
-int SkTypeface::onGetTableTags(SkFontTableTag tags[]) const { return 0; }
-size_t SkTypeface::onGetTableData(SkFontTableTag, size_t offset,
- size_t length, void* data) const { return 0; }
void SkTypeface::onGetFontDescriptor(SkFontDescriptor* desc) const {
desc->setStyle(this->style());
}
+#include "SkFontStream.h"
+#include "SkStream.h"
+
+int SkTypeface::onGetTableTags(SkFontTableTag tags[]) const {
+ int ttcIndex;
+ SkAutoTUnref<SkStream> stream(this->openStream(&ttcIndex));
+ return stream.get() ? SkFontStream::GetTableTags(stream, ttcIndex, tags) : 0;
+}
+
+size_t SkTypeface::onGetTableData(SkFontTableTag tag, size_t offset,
+ size_t length, void* data) const {
+ int ttcIndex;
+ SkAutoTUnref<SkStream> stream(this->openStream(&ttcIndex));
+ return stream.get()
+ ? SkFontStream::GetTableData(stream, ttcIndex, tag, offset, length, data)
+ : 0;
+}
+
« no previous file with comments | « trunk/include/core/SkFontHost.h ('k') | trunk/src/ports/SkFontHost_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698