diff options
author | 2013-03-14 15:04:57 +0000 | |
---|---|---|
committer | 2013-03-14 15:04:57 +0000 | |
commit | fed86bdb8b9f037439bbfa7cdbd53a581dbc5985 (patch) | |
tree | b03a35f11ee303aed8cd9c3c6210b22ba463c2dc /src/core/SkTypeface.cpp | |
parent | a936e37cc76614868f5b489395bceeb340cc04cd (diff) |
move most of SkFontHost to private (preceeding making it all private)
In this change, have to accomodate PDF wanting to call openStream and advancedMetrics
Review URL: https://codereview.chromium.org/12739006
git-svn-id: http://skia.googlecode.com/svn/trunk@8156 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkTypeface.cpp')
-rw-r--r-- | src/core/SkTypeface.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 7699470727..80fa43825d 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -49,6 +49,10 @@ SkTypeface* SkTypeface::GetDefaultTypeface() { return gDefaultTypeface; } +SkTypeface* SkTypeface::RefDefault() { + return SkRef(GetDefaultTypeface()); +} + uint32_t SkTypeface::UniqueID(const SkTypeface* face) { if (NULL == face) { face = GetDefaultTypeface(); @@ -121,6 +125,15 @@ size_t SkTypeface::getTableData(SkFontTableTag tag, size_t offset, size_t length return SkFontHost::GetTableData(fUniqueID, tag, offset, length, data); } +SkStream* SkTypeface::openStream(int* ttcIndex) const { + if (ttcIndex) { + int32_t ndx = 0; + (void)SkFontHost::GetFileName(fUniqueID, NULL, 0, &ndx); + *ttcIndex = (int)ndx; + } + return SkFontHost::OpenStream(fUniqueID); +} + int SkTypeface::getUnitsPerEm() const { int upem = 0; @@ -139,6 +152,16 @@ int SkTypeface::getUnitsPerEm() const { return upem; } +// TODO: move this impl into the subclass +SkScalerContext* SkTypeface::onCreateScalerContext(const SkDescriptor* desc) const { + return SkFontHost::CreateScalerContext(desc); +} + +// TODO: move this impl into the subclass +void SkTypeface::onFilterRec(SkScalerContextRec* rec) const { + SkFontHost::FilterRec(rec, const_cast<SkTypeface*>(this)); +} + /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -148,10 +171,6 @@ int SkTypeface::onGetUPEM() const { return 0; } int SkTypeface::onGetTableTags(SkFontTableTag tags[]) const { return 0; } size_t SkTypeface::onGetTableData(SkFontTableTag, size_t offset, size_t length, void* data) const { return 0; } -SkScalerContext* SkTypeface::onCreateScalerContext(const SkDescriptor*) const { - return NULL; -} -void SkTypeface::onFilterRec(SkScalerContextRec*) const {} void SkTypeface::onGetFontDescriptor(SkFontDescriptor* desc) const { desc->setStyle(this->style()); } |