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

Unified Diff: src/ports/SkFontMgr_fontconfig.cpp

Issue 1027373002: Font variations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Initial Mac implementation (buggy). Created 5 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
Index: src/ports/SkFontMgr_fontconfig.cpp
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index 485e0fc6cc235846f581786f4c8d00c49c192ce3..31aa29b759075446ad955eb19310b42150b32634 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,7 +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->setFontIndex(get_int(fPattern, FC_INDEX, 0));
*serialize = false;
}
@@ -430,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;
@@ -817,7 +827,7 @@ protected:
SkFontStyle style;
bool isFixedWidth = false;
- if (!fScanner.scanFont(stream, ttcIndex, NULL, &style, &isFixedWidth)) {
+ if (!fScanner.scanFont(stream, ttcIndex, NULL, 0, NULL, &style, &isFixedWidth, NULL)) {
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698