diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 22:19:11 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 22:19:11 +0000 |
commit | aef1e52ad8d79a9db8ffffa9828ce7b66c405613 (patch) | |
tree | 2f401403e7b559b9f80fe22211eb168d5a9870e8 /skia/ext/SkFontHost_fontconfig_direct.cpp | |
parent | d70539de3df8f214397881727229a7786da9be35 (diff) | |
download | chromium_src-aef1e52ad8d79a9db8ffffa9828ce7b66c405613.zip chromium_src-aef1e52ad8d79a9db8ffffa9828ce7b66c405613.tar.gz chromium_src-aef1e52ad8d79a9db8ffffa9828ce7b66c405613.tar.bz2 |
Linux: fix double italic on some fonts.
If we ask fontconfig for an italic font, it 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.
BUG=15212
http://codereview.chromium.org/147108
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/SkFontHost_fontconfig_direct.cpp')
-rw-r--r-- | skia/ext/SkFontHost_fontconfig_direct.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/skia/ext/SkFontHost_fontconfig_direct.cpp b/skia/ext/SkFontHost_fontconfig_direct.cpp index dc20aff..a732d06 100644 --- a/skia/ext/SkFontHost_fontconfig_direct.cpp +++ b/skia/ext/SkFontHost_fontconfig_direct.cpp @@ -179,10 +179,23 @@ 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 we ask for an italic font, fontconfig might take a roman font and set + // FC_EMBOLDEN. + FcValue embolden; + const bool have_embolden = + FcPatternGet(match, FC_EMBOLDEN, 0, &embolden) == 0; + if (is_bold) - *is_bold = resulting_bold >= FC_WEIGHT_BOLD; + *is_bold = resulting_bold >= FC_WEIGHT_BOLD && !have_embolden; 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; |