diff options
author | fmalita <fmalita@chromium.org> | 2015-11-20 13:47:55 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-20 13:47:55 -0800 |
commit | 9b137dc54e668ca5552bab8a1c550edc02214db4 (patch) | |
tree | c88fbe21eac5d5ade1c55f64489a815b80b9a5c3 /include/ports/SkFontConfigInterface.h | |
parent | d76be9c79baa1530d3dc95c58022e83607a1bb2a (diff) |
SkFontConfigInterface::createTypeface()
BUG=524578
R=bungeman@google.com,reed@google.com
Review URL: https://codereview.chromium.org/1454343003
Diffstat (limited to 'include/ports/SkFontConfigInterface.h')
-rw-r--r-- | include/ports/SkFontConfigInterface.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h index fd5e812a5b..304961fd78 100644 --- a/include/ports/SkFontConfigInterface.h +++ b/include/ports/SkFontConfigInterface.h @@ -95,6 +95,18 @@ public: virtual SkStreamAsset* openStream(const FontIdentity&) = 0; /** + * Return an SkTypeface for the given FontIdentity. + * + * The default implementation simply returns a new typeface built using data obtained from + * openStream(), but derived classes may implement more complex caching schemes. + * + * Callers are responsible for unref-ing the result. + */ + virtual SkTypeface* createTypeface(const FontIdentity& identity) { + return SkTypeface::CreateFromStream(this->openStream(identity), identity.fTTCIndex); + } + + /** * Return a singleton instance of a direct subclass that calls into * libfontconfig. This does not affect the refcnt of the returned instance. * The mutex may be used to guarantee the singleton is only constructed once. |