diff options
author | 2013-07-30 17:47:39 +0000 | |
---|---|---|
committer | 2013-07-30 17:47:39 +0000 | |
commit | 30ddd615c447fed73286151b463af20d309c85f1 (patch) | |
tree | 03f06598408958e47d01a638db285546cd122a29 /include/core/SkTypeface.h | |
parent | 2d859346dd4c583cae84e485bfa87ef97ffaebc1 (diff) |
refactoring for SK_FONTHOST_USES_FONTMGR option
BUG=
R=bungeman@google.com
Review URL: https://codereview.chromium.org/21149008
git-svn-id: http://skia.googlecode.com/svn/trunk@10440 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkTypeface.h')
-rw-r--r-- | include/core/SkTypeface.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h index 429a24b18a..fccbe1f62e 100644 --- a/include/core/SkTypeface.h +++ b/include/core/SkTypeface.h @@ -240,6 +240,17 @@ public: SkStream* openStream(int* ttcIndex) const; /** + * Search within this typeface's family for a best match to the + * specified style, and return a ref to that typeface. Note: the + * returned object could be this, if it is the best match, or it + * could be a different typeface. Either way, the caller must balance + * this call with unref() on the returned object. + * + * Will never return NULL. + */ + SkTypeface* refMatchingStyle(Style) const; + + /** * Return a scalercontext for the given descriptor. If this fails, then * if allowFailure is true, this returns NULL, else it returns a * dummy scalercontext that will not crash, but will draw nothing. @@ -287,6 +298,13 @@ protected: virtual size_t onGetTableData(SkFontTableTag, size_t offset, size_t length, void* data) const; + // TODO: make this pure-virtual when all ports have overridden it + virtual SkTypeface* onRefMatchingStyle(Style styleBits) const { + SkASSERT(!"unimplemented"); + this->ref(); + return const_cast<SkTypeface*>(this); + } + private: SkFontID fUniqueID; Style fStyle; |