Index: src/ports/SkFontConfigTypeface.h |
diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h |
index 590c6fac89aa086bbd78ef6054d2108b06f50ec5..b636052c471829e73f6b462aadd0b9c86ffc9f11 100644 |
--- a/src/ports/SkFontConfigTypeface.h |
+++ b/src/ports/SkFontConfigTypeface.h |
@@ -6,17 +6,18 @@ |
*/ |
#include "SkFontConfigInterface.h" |
+#include "SkFontDescriptor.h" |
#include "SkFontHost_FreeType_common.h" |
+#include "SkRefCnt.h" |
#include "SkStream.h" |
-#include "SkTypefaceCache.h" |
class SkFontDescriptor; |
class SkTypeface_FCI : public SkTypeface_FreeType { |
- SkAutoTUnref<SkFontConfigInterface> fFCI; |
+ sk_sp<SkFontConfigInterface> fFCI; |
SkFontConfigInterface::FontIdentity fIdentity; |
SkString fFamilyName; |
- SkAutoTDelete<SkStreamAsset> fLocalStream; |
+ std::unique_ptr<SkFontData> fFontData; |
public: |
static SkTypeface_FCI* Create(SkFontConfigInterface* fci, |
@@ -27,24 +28,16 @@ public: |
return new SkTypeface_FCI(fci, fi, familyName, style); |
} |
- static SkTypeface_FCI* Create(const SkFontStyle& style, bool fixedWidth, |
- SkStreamAsset* localStream, int index) |
+ static SkTypeface_FCI* Create(std::unique_ptr<SkFontData> data, |
+ SkFontStyle style, bool isFixedPitch) |
{ |
- return new SkTypeface_FCI(style, fixedWidth, localStream, index); |
+ return new SkTypeface_FCI(std::move(data), style, isFixedPitch); |
} |
const SkFontConfigInterface::FontIdentity& getIdentity() const { |
return fIdentity; |
} |
- SkStreamAsset* getLocalStream() const { |
- return fLocalStream.get(); |
- } |
- |
- bool isFamilyName(const char* name) const { |
- return fFamilyName.equals(name); |
- } |
- |
protected: |
SkTypeface_FCI(SkFontConfigInterface* fci, |
const SkFontConfigInterface::FontIdentity& fi, |
@@ -54,18 +47,20 @@ protected: |
, fFCI(SkRef(fci)) |
, fIdentity(fi) |
, fFamilyName(familyName) |
- , fLocalStream(nullptr) {} |
+ , fFontData(nullptr) {} |
- SkTypeface_FCI(const SkFontStyle& style, bool fixedWidth, SkStreamAsset* localStream, int index) |
- : INHERITED(style, fixedWidth) |
- , fLocalStream(localStream) |
+ SkTypeface_FCI(std::unique_ptr<SkFontData> data, SkFontStyle style, bool isFixedPitch) |
+ : INHERITED(style, isFixedPitch) |
+ , fFontData(std::move(data)) |
{ |
- fIdentity.fTTCIndex = index; |
+ SkASSERT(fFontData); |
+ fIdentity.fTTCIndex = fFontData->getIndex(); |
} |
void onGetFamilyName(SkString* familyName) const override { *familyName = fFamilyName; } |
void onGetFontDescriptor(SkFontDescriptor*, bool*) const override; |
SkStreamAsset* onOpenStream(int* ttcIndex) const override; |
+ SkFontData* onCreateFontData() const override; |
private: |
typedef SkTypeface_FreeType INHERITED; |