diff options
author | bungeman <bungeman@google.com> | 2014-09-18 10:55:32 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-18 10:55:32 -0700 |
commit | d71b75757335393d9643a5b7a0f2769b6ba52fb6 (patch) | |
tree | 24896b8f1ee45232d610d73fad13ed21ff9c6e4d /src/core/SkFontDescriptor.h | |
parent | 65b427cff9cd34a06ff060d65d00cc3615d8fd94 (diff) |
Serialize the font index.
BUG=skia:1186
R=reed@google.com
Author: bungeman@google.com
Review URL: https://codereview.chromium.org/567013002
Diffstat (limited to 'src/core/SkFontDescriptor.h')
-rw-r--r-- | src/core/SkFontDescriptor.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/core/SkFontDescriptor.h b/src/core/SkFontDescriptor.h index 5febfd81a3..5a6ddd5e41 100644 --- a/src/core/SkFontDescriptor.h +++ b/src/core/SkFontDescriptor.h @@ -8,10 +8,10 @@ #ifndef SkFontDescriptor_DEFINED #define SkFontDescriptor_DEFINED +#include "SkStream.h" #include "SkString.h" #include "SkTypeface.h" -class SkStream; class SkWStream; class SkFontDescriptor { @@ -24,21 +24,30 @@ public: SkTypeface::Style getStyle() { return fStyle; } void setStyle(SkTypeface::Style style) { fStyle = style; } - const char* getFamilyName() { return fFamilyName.c_str(); } - const char* getFullName() { return fFullName.c_str(); } - const char* getPostscriptName() { return fPostscriptName.c_str(); } - const char* getFontFileName() { return fFontFileName.c_str(); } + const char* getFamilyName() const { return fFamilyName.c_str(); } + const char* getFullName() const { return fFullName.c_str(); } + const char* getPostscriptName() const { return fPostscriptName.c_str(); } + const char* getFontFileName() const { return fFontFileName.c_str(); } + SkStream* getFontData() const { return fFontData; } + int getFontIndex() const { return fFontIndex; } void setFamilyName(const char* name) { fFamilyName.set(name); } void setFullName(const char* name) { fFullName.set(name); } void setPostscriptName(const char* name) { fPostscriptName.set(name); } void setFontFileName(const char* name) { fFontFileName.set(name); } + /** Set the font data only if it is necessary for serialization. + * This method takes ownership of the stream (both reference and cursor). + */ + void setFontData(SkStream* stream) { fFontData.reset(stream); } + void setFontIndex(int index) { fFontIndex = index; } private: SkString fFamilyName; SkString fFullName; SkString fPostscriptName; SkString fFontFileName; + SkAutoTUnref<SkStream> fFontData; + int fFontIndex; SkTypeface::Style fStyle; }; |