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

Unified Diff: src/ports/SkFontConfigTypeface.h

Issue 2296843002: SkFontMgr_FontConfigInterface create typeface from FontParameters. (Closed)
Patch Set: Consistent order, remove unwanted change. Created 4 years, 4 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
« no previous file with comments | « no previous file | src/ports/SkFontMgr_FontConfigInterface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | src/ports/SkFontMgr_FontConfigInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698