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

Unified Diff: src/ports/SkFontMgr_android.cpp

Issue 1027373002: Font variations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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_android.cpp
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 11f944997111e1b12ed972758e0ea89d1bf81fa2..20a64d2ef8b8bd1af1a9615cd60b98aa885bb999 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -51,6 +51,7 @@ class SkTypeface_AndroidSystem : public SkTypeface_Android {
public:
SkTypeface_AndroidSystem(const SkString& pathName,
int index,
+ const SkTArray<SkFixed, true>& axes,
const SkFontStyle& style,
bool isFixedPitch,
const SkString& familyName,
@@ -59,7 +60,8 @@ public:
: INHERITED(index, style, isFixedPitch, familyName)
, fPathName(pathName)
, fLang(lang)
- , fVariantStyle(variantStyle) { }
+ , fVariantStyle(variantStyle)
+ , fAxes(axes) { }
virtual void onGetFontDescriptor(SkFontDescriptor* desc,
bool* serialize) const SK_OVERRIDE {
@@ -67,17 +69,26 @@ public:
SkASSERT(serialize);
desc->setFamilyName(fFamilyName.c_str());
desc->setFontFileName(fPathName.c_str());
- desc->setFontIndex(fIndex);
+ desc->getFontParameters().fIndex = fIndex;
*serialize = false;
}
SkStreamAsset* onOpenStream(int* ttcIndex) const SK_OVERRIDE {
*ttcIndex = fIndex;
return SkStream::NewFromFile(fPathName.c_str());
}
+ SkStreamAsset* onOpenStream2(SkFontParameters* params) const SK_OVERRIDE {
+ params->fIndex = fIndex;
+ params->fAxis.reset(fAxes.count());
+ for (int i = 0 ; i < fAxes.count(); ++i) {
+ params->fAxis[i] = fAxes[i];
+ }
+ return SkStream::NewFromFile(fPathName.c_str());
+ }
const SkString fPathName;
const SkLanguage fLang;
const FontVariant fVariantStyle;
+ const SkTArray<SkFixed, true> fAxes;
typedef SkTypeface_Android INHERITED;
};
@@ -163,7 +174,7 @@ public:
}
fStyles.push_back().reset(SkNEW_ARGS(SkTypeface_AndroidSystem,
- (pathName, ttcIndex,
+ (pathName, ttcIndex, fontFile.fAxes,
style, isFixedWidth, familyName,
lang, variant)));
}

Powered by Google App Engine
This is Rietveld 408576698