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

Unified Diff: src/ports/SkFontMgr_fontconfig.cpp

Issue 1027373002: Font variations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Slightly more palatable. Created 5 years, 9 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: src/ports/SkFontMgr_fontconfig.cpp
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index dc4d8c5a8cb7d57db3a82956db7b519f7910a561..02fb51a58a16aed3913253eb97cd0925c88e8b79 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -387,7 +387,6 @@ public:
}
void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) const override {
- desc->setFontIndex(fIndex);
*serialize = true;
}
@@ -396,6 +395,11 @@ public:
return fStream->duplicate();
}
+ SkFontData* onCreateFontData() const override {
+ SkFixed axis[1] = { SK_Fixed1 };
+ return new SkFontData(fStream->duplicate(), fIndex, 1, axis);
+ };
+
private:
SkAutoTDelete<SkStreamAsset> fStream;
int fIndex;
@@ -420,8 +424,6 @@ public:
desc->setFamilyName(get_string(fPattern, FC_FAMILY));
desc->setFullName(get_string(fPattern, FC_FULLNAME));
desc->setPostscriptName(get_string(fPattern, FC_POSTSCRIPT_NAME));
- desc->setFontFileName(get_string(fPattern, FC_FILE));
- desc->setFontIndex(get_int(fPattern, FC_INDEX, 0));
*serialize = false;
}
@@ -431,6 +433,13 @@ public:
return SkStream::NewFromFile(get_string(fPattern, FC_FILE));
}
+ SkFontData* onCreateFontData() const override {
+ SkFixed axis[1] = { SK_Fixed1 };
+ return new SkFontData(SkStream::NewFromFile(get_string(fPattern, FC_FILE)),
+ get_int(fPattern, FC_INDEX, 0),
+ 1, axis);
+ };
+
virtual ~SkTypeface_fontconfig() {
// Hold the lock while unrefing the pattern.
FCLocker lock;

Powered by Google App Engine
This is Rietveld 408576698