Index: include/ports/SkFontConfigInterface.h |
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h |
index fd5e812a5b49319be5c2be11a2ae0d434e55bbe0..304961fd7862358c6ed257b72aadceb02ab0bfb2 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. |