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

Unified Diff: skia/ext/SkFontHost_fontconfig_direct.cpp

Issue 147108: Linux: fix double italic on some fonts. (Closed)
Patch Set: Created 11 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/SkFontHost_fontconfig_direct.cpp
diff --git a/skia/ext/SkFontHost_fontconfig_direct.cpp b/skia/ext/SkFontHost_fontconfig_direct.cpp
index dc20afffc51c6b4b98215e3073ad8c2e7bd9f9ff..8c89d551e9bf4e9b7de9980e06d322ac942eb4ec 100644
--- a/skia/ext/SkFontHost_fontconfig_direct.cpp
+++ b/skia/ext/SkFontHost_fontconfig_direct.cpp
@@ -179,10 +179,17 @@ bool FontConfigDirect::Match(std::string* result_family,
if (FcPatternGetInteger(match, FC_SLANT, 0, &resulting_italic))
resulting_italic = FC_SLANT_ROMAN;
+ // If we ask for an italic font, fontconfig might take a roman font and set
+ // the undocumented property FC_MATRIX to a skew matrix. It'll then say
+ // that the font is italic or oblique. So, if we see a matrix, we don't
+ // believe that it's italic.
+ FcValue matrix;
+ const bool have_matrix = FcPatternGet(match, FC_MATRIX, 0, &matrix) == 0;
+
if (is_bold)
*is_bold = resulting_bold >= FC_WEIGHT_BOLD;
if (is_italic)
- *is_italic = resulting_italic == FC_SLANT_ITALIC;
+ *is_italic = resulting_italic > FC_SLANT_ROMAN && !have_matrix;
if (result_family)
*result_family = (char *) c_family;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698