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

Unified Diff: src/ports/SkFontMgr_fontconfig.cpp

Issue 488143002: Replace SkTypeface::Style with SkFontStyle. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add expectations, remove whitespace. Created 6 years, 2 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/SkFontMgr_android.cpp ('k') | src/ports/SkFontMgr_win_dw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontMgr_fontconfig.cpp
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index 6fc1f28c89bc318ce2d26622b5acf94f0da295ef..dbc64b6e47655749ab8bf2919e708f01b10eacf3 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -373,20 +373,13 @@ static void fcpattern_from_skfontstyle(SkFontStyle style, FcPattern* pattern) {
FcPatternAddInteger(pattern, FC_SLANT, style.isItalic() ? FC_SLANT_ITALIC : FC_SLANT_ROMAN);
}
-static SkTypeface::Style sktypefacestyle_from_fcpattern(FcPattern* pattern) {
- int fcweight = get_int(pattern, FC_WEIGHT, FC_WEIGHT_REGULAR);
- int fcslant = get_int(pattern, FC_SLANT, FC_SLANT_ROMAN);
- return (SkTypeface::Style)((fcweight >= FC_WEIGHT_BOLD ? SkTypeface::kBold : 0) |
- (fcslant > FC_SLANT_ROMAN ? SkTypeface::kItalic : 0));
-}
-
class SkTypeface_stream : public SkTypeface_FreeType {
public:
/** @param stream does not take ownership of the reference, does take ownership of the stream.*/
- SkTypeface_stream(SkTypeface::Style style, bool fixedWidth, int ttcIndex, SkStreamAsset* stream)
+ SkTypeface_stream(const SkFontStyle& style, bool fixedWidth, int index, SkStreamAsset* stream)
: INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth)
, fStream(SkRef(stream))
- , fIndex(ttcIndex)
+ , fIndex(index)
{ };
virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE {
@@ -447,7 +440,7 @@ public:
private:
/** @param pattern takes ownership of the reference. */
SkTypeface_fontconfig(FcPattern* pattern)
- : INHERITED(sktypefacestyle_from_fcpattern(pattern),
+ : INHERITED(skfontstyle_from_fcpattern(pattern),
SkTypefaceCache::NewFontID(),
FC_PROPORTIONAL != get_int(pattern, FC_SPACING, FC_PROPORTIONAL))
, fPattern(pattern)
@@ -571,7 +564,7 @@ class SkFontMgr_fontconfig : public SkFontMgr {
sizes.begin(), names.count());
}
- static bool FindByFcPattern(SkTypeface* cached, SkTypeface::Style, void* ctx) {
+ static bool FindByFcPattern(SkTypeface* cached, const SkFontStyle&, void* ctx) {
SkTypeface_fontconfig* cshFace = static_cast<SkTypeface_fontconfig*>(cached);
FcPattern* ctxPattern = static_cast<FcPattern*>(ctx);
return FcTrue == FcPatternEqual(cshFace->fPattern, ctxPattern);
@@ -590,7 +583,7 @@ class SkFontMgr_fontconfig : public SkFontMgr {
FcPatternReference(pattern);
face = SkTypeface_fontconfig::Create(pattern);
if (face) {
- fTFCache.add(face, SkTypeface::kNormal, true);
+ fTFCache.add(face, SkFontStyle(), true);
}
}
return face;
@@ -818,7 +811,7 @@ protected:
return NULL;
}
- SkTypeface::Style style = SkTypeface::kNormal;
+ SkFontStyle style;
bool isFixedWidth = false;
if (!SkTypeface_FreeType::ScanFont(stream, ttcIndex, NULL, &style, &isFixedWidth)) {
return NULL;
« no previous file with comments | « src/ports/SkFontMgr_android.cpp ('k') | src/ports/SkFontMgr_win_dw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698