aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2015-05-13 10:57:09 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-13 10:57:10 -0700
commit05773ed30920c0214d1433c07cf6360a05476c97 (patch)
tree5da7ade81a22ca07b2018f42b111bc861bf1edcd /include/core
parentc5f1c5414fc8f73cbefadcc1b24ec794056fa203 (diff)
Font variations.
Multiple Master and TrueType fonts support variation axes. This implements back-end support for axes on platforms which support it. Review URL: https://codereview.chromium.org/1027373002
Diffstat (limited to 'include/core')
-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[],