Index: include/core/SkTypeface.h |
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h |
index 6a6d7241a2c861a1268ef992b5d87ed7b652d379..1fb9ef70e425a3a1c3a0017cbcfa6e041d3e7ed6 100644 |
--- a/include/core/SkTypeface.h |
+++ b/include/core/SkTypeface.h |
@@ -16,6 +16,7 @@ |
#include "SkWeakRefCnt.h" |
class SkDescriptor; |
+class SkFontData; |
class SkFontDescriptor; |
class SkScalerContext; |
struct SkScalerContextRec; |
@@ -133,6 +134,12 @@ public: |
*/ |
static SkTypeface* CreateFromStream(SkStreamAsset* stream, int index = 0); |
+ /** Return a new typeface given font data and configuration. If the data |
+ is not valid font data, returns null. Ownership of the stream is |
reed1
2015/05/08 20:46:30
ownership of the data?
bungeman-skia
2015/05/11 22:09:35
Right now the caller retains ownership of the SkFo
|
+ transferred, so the caller must not reference it again. |
+ */ |
+ static SkTypeface* CreateFromFontData(SkFontData*); |
+ |
/** Write a unique signature to a stream, sufficient to reconstruct a |
typeface referencing the same font when Deserialize is called. |
*/ |
@@ -281,6 +288,7 @@ public: |
* The caller is responsible for deleting the stream. |
*/ |
SkStreamAsset* openStream(int* ttcIndex) const; |
+ SkFontData* createFontData() const; |
/** |
* Return a scalercontext for the given descriptor. If this fails, then |
@@ -326,6 +334,9 @@ protected: |
uint32_t glyphIDsCount) const = 0; |
virtual SkStreamAsset* onOpenStream(int* ttcIndex) const = 0; |
+ // TODO: make pure virtual. |
+ virtual SkFontData* onCreateFontData() const; |
+ |
virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0; |
virtual int onCharsToGlyphs(const void* chars, Encoding, uint16_t glyphs[], |