Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: include/core/SkTypeface.h

Issue 1027373002: Font variations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Android and tests. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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[],

Powered by Google App Engine
This is Rietveld 408576698