Reintroduce default impls removed in 10495.

Due to poor placement of overrides in the hierarchy, nacl is failing.


git-svn-id: http://skia.googlecode.com/svn/trunk@10497 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bungeman@google.com 2013-08-01 21:01:28 +00:00
parent b10b51f64d
commit 397a9546e4
2 changed files with 24 additions and 4 deletions

View File

@ -22,7 +22,6 @@ class SkAdvancedTypefaceMetrics;
class SkWStream;
typedef uint32_t SkFontID;
/** Machine endian. */
typedef uint32_t SkFontTableTag;
/** \class SkTypeface
@ -295,11 +294,16 @@ protected:
virtual int onGetUPEM() const = 0;
virtual int onGetTableTags(SkFontTableTag tags[]) const = 0;
virtual int onGetTableTags(SkFontTableTag tags[]) const;
virtual size_t onGetTableData(SkFontTableTag, size_t offset,
size_t length, void* data) const = 0;
size_t length, void* data) const;
virtual SkTypeface* onRefMatchingStyle(Style styleBits) const = 0;
// TODO: make this pure-virtual when all ports have overridden it
virtual SkTypeface* onRefMatchingStyle(Style styleBits) const {
SkASSERT(0);
this->ref();
return const_cast<SkTypeface*>(this);
}
private:
SkFontID fUniqueID;

View File

@ -8,6 +8,7 @@
#include "SkAdvancedTypefaceMetrics.h"
#include "SkFontDescriptor.h"
#include "SkFontHost.h"
#include "SkFontStream.h"
#include "SkStream.h"
#include "SkTypeface.h"
@ -223,3 +224,18 @@ int SkTypeface::onCharsToGlyphs(const void* chars, Encoding encoding,
}
return 0;
}
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;
}