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

Unified Diff: src/ports/SkFontConfigTypeface.h

Issue 1936213002: Clean up SkFontConfigInterface implementation. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkOnce Created 4 years, 8 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 | « src/ports/SkFontConfigInterface_direct_google3_factory.cpp ('k') | src/ports/SkFontHost_fontconfig.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 00e00cf2edce88f3e28637993d11a1332e419d1d..eb5db94fdf6c03c8e521d953cedc84e108808231 100644
--- a/src/ports/SkFontConfigTypeface.h
+++ b/src/ports/SkFontConfigTypeface.h
@@ -12,51 +12,58 @@
class SkFontDescriptor;
-class FontConfigTypeface : public SkTypeface_FreeType {
+class SkTypeface_FCI : public SkTypeface_FreeType {
+ SkAutoTUnref<SkFontConfigInterface> fFCI;
SkFontConfigInterface::FontIdentity fIdentity;
SkString fFamilyName;
SkAutoTDelete<SkStreamAsset> fLocalStream;
public:
- static FontConfigTypeface* Create(const SkFontStyle& style,
- const SkFontConfigInterface::FontIdentity& fi,
- const SkString& familyName) {
- return new FontConfigTypeface(style, fi, familyName);
+ static SkTypeface_FCI* Create(SkFontConfigInterface* fci,
+ const SkFontConfigInterface::FontIdentity& fi,
+ const SkString& familyName,
+ const SkFontStyle& style)
+ {
+ return new SkTypeface_FCI(fci, fi, familyName, style);
}
- static FontConfigTypeface* Create(const SkFontStyle& style, bool fixedWidth,
- SkStreamAsset* localStream) {
- return new FontConfigTypeface(style, fixedWidth, localStream);
+ static SkTypeface_FCI* Create(const SkFontStyle& style, bool fixedWidth,
+ SkStreamAsset* localStream, int index)
+ {
+ return new SkTypeface_FCI(style, fixedWidth, localStream, index);
}
const SkFontConfigInterface::FontIdentity& getIdentity() const {
return fIdentity;
}
- SkStreamAsset* getLocalStream() const { return fLocalStream.get(); }
+ SkStreamAsset* getLocalStream() const {
+ return fLocalStream.get();
+ }
bool isFamilyName(const char* name) const {
return fFamilyName.equals(name);
}
- static SkTypeface* LegacyCreateTypeface(const char familyName[], SkFontStyle);
-
protected:
- FontConfigTypeface(const SkFontStyle& style,
- const SkFontConfigInterface::FontIdentity& fi,
- const SkString& familyName)
+ SkTypeface_FCI(SkFontConfigInterface* fci,
+ const SkFontConfigInterface::FontIdentity& fi,
+ const SkString& familyName,
+ const SkFontStyle& style)
: INHERITED(style, SkTypefaceCache::NewFontID(), false)
+ , fFCI(SkRef(fci))
, fIdentity(fi)
, fFamilyName(familyName)
, fLocalStream(nullptr) {}
- FontConfigTypeface(const SkFontStyle& style, bool fixedWidth, SkStreamAsset* localStream)
+ SkTypeface_FCI(const SkFontStyle& style, bool fixedWidth, SkStreamAsset* localStream, int index)
: INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth)
- , fLocalStream(localStream) {
- // we default to empty fFamilyName and fIdentity
+ , fLocalStream(localStream)
+ {
+ fIdentity.fTTCIndex = index;
}
- void onGetFamilyName(SkString* familyName) const override;
+ void onGetFamilyName(SkString* familyName) const override { *familyName = fFamilyName; }
void onGetFontDescriptor(SkFontDescriptor*, bool*) const override;
SkStreamAsset* onOpenStream(int* ttcIndex) const override;
« no previous file with comments | « src/ports/SkFontConfigInterface_direct_google3_factory.cpp ('k') | src/ports/SkFontHost_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698