aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkTypeface.h
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2015-05-14 14:18:02 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-14 14:18:03 -0700
commit3489ee0f4fa34f124f9de090d12bdc2107d52aa9 (patch)
treed9fc4a423ae383b4aece6459d10b4f4134223692 /include/core/SkTypeface.h
parent86a17e7716c8db858e219a46b9db3817bb770bee (diff)
Font variations.
Multiple Master and TrueType fonts support variation axes. This implements back-end support for axes on platforms which support it. Committed: https://skia.googlesource.com/skia/+/05773ed30920c0214d1433c07cf6360a05476c97 Review URL: https://codereview.chromium.org/1027373002
Diffstat (limited to 'include/core/SkTypeface.h')
-rw-r--r--include/core/SkTypeface.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index 7d8b892f2c..f0059deb25 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -17,6 +17,7 @@
#include "SkWeakRefCnt.h"
class SkDescriptor;
+class SkFontData;
class SkFontDescriptor;
class SkScalerContext;
struct SkScalerContextRec;
@@ -134,6 +135,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 font data is
+ 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.
*/
@@ -284,6 +291,12 @@ public:
SkStreamAsset* openStream(int* ttcIndex) const;
/**
+ * Return the font data, or NULL on failure.
+ * The caller is responsible for deleting the font data.
+ */
+ SkFontData* createFontData() 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.
@@ -337,6 +350,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[],