summaryrefslogtreecommitdiffstats
path: root/skia/ext/SkFontHost_fontconfig.cpp
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 02:32:32 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 02:32:32 +0000
commitce1f48ec9ba4c877a8144b9734c478d9e0d0d951 (patch)
tree540bc526eb033c37a90e55e5d3461ae973a9b040 /skia/ext/SkFontHost_fontconfig.cpp
parente684a31a3733e0a3047c56c818a9cd42742b0ba4 (diff)
downloadchromium_src-ce1f48ec9ba4c877a8144b9734c478d9e0d0d951.zip
chromium_src-ce1f48ec9ba4c877a8144b9734c478d9e0d0d951.tar.gz
chromium_src-ce1f48ec9ba4c877a8144b9734c478d9e0d0d951.tar.bz2
Linux: fix fake italics for fonts without italic variants.
Before this patch we assumed that the style which we got from fontconfig was the one that we asked for. Rather than do this we need to query the resulting style and plumb that back into WebKit. Once WebKit knows that there's a mismatch between the request and actual styles it can trigger faking. BUG=14810 http://codereview.chromium.org/147005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/SkFontHost_fontconfig.cpp')
-rw-r--r--skia/ext/SkFontHost_fontconfig.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/skia/ext/SkFontHost_fontconfig.cpp b/skia/ext/SkFontHost_fontconfig.cpp
index 04ac5b9d..2ecbe6c 100644
--- a/skia/ext/SkFontHost_fontconfig.cpp
+++ b/skia/ext/SkFontHost_fontconfig.cpp
@@ -101,7 +101,7 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
const unsigned fileid = UniqueIdToFileId(familyFace->uniqueID());
if (!GetFcImpl()->Match(
&resolved_family_name, NULL, true /* fileid valid */, fileid, "",
- -1, -1)) {
+ NULL, NULL)) {
return NULL;
}
} else if (familyName) {
@@ -110,16 +110,19 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
return NULL;
}
- const bool bold = style & SkTypeface::kBold;
- const bool italic = style & SkTypeface::kItalic;
+ bool bold = style & SkTypeface::kBold;
+ bool italic = style & SkTypeface::kItalic;
unsigned fileid;
if (!GetFcImpl()->Match(NULL, &fileid, false, -1, /* no fileid */
- resolved_family_name, bold, italic)) {
+ resolved_family_name, &bold, &italic)) {
return NULL;
}
+ const SkTypeface::Style resulting_style = static_cast<SkTypeface::Style>(
+ (bold ? SkTypeface::kBold : 0) |
+ (italic ? SkTypeface::kItalic : 0));
- const unsigned id = FileIdAndStyleToUniqueId(fileid, style);
- SkTypeface* typeface = SkNEW_ARGS(FontConfigTypeface, (style, id));
+ const unsigned id = FileIdAndStyleToUniqueId(fileid, resulting_style);
+ SkTypeface* typeface = SkNEW_ARGS(FontConfigTypeface, (resulting_style, id));
{
SkAutoMutexAcquire ac(global_fc_map_lock);