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

Issue 668127: linux: handle basic metric-compatibile font fallback (Closed)

Created:
10 years, 9 months ago by Evan Martin
Modified:
9 years, 7 months ago
Reviewers:
agl
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

linux: handle basic metric-compatibile font fallback When a page CSS asks for: font-family: Arial, sans-serif; and you don't have Arial, fontconfig tries to provide a substitute. However, as far as I can tell there is no way to distinguish fontconfig picking Liberation Sans (a metric-equivalent substitute for Arial) or it picking a bad substitute like Times New Roman. So historically we didn't allow fontconfig to do any fallback at all. (In this example, we would then match attempt to match sans-serif, which as a last resort we do allow fontconfig to do fallback on, so it could pick e.g. DejaVu Sans or any other font matching "sans".) Frustratingly, fontconfig knows whether a font substitute is an equivalent font or just a last-resort fallback one -- in the XML files the equivalents are marked with 'binding="same"' -- but I played around with the API for a few hours and couldn't figure out any way to get this information out of it. So I hardcode a list of equivalent fonts. Ugh. This fixes some sites where they specify Arial and then have pixel-width-specified page layout that breaks when you use any other sans-serif font. BUG=18159, 32005, 33125 ,others I've since forgotten about TEST=uninstall Arial; visit one of the sites mentioned in the bug list Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=40912

Patch Set 1 #

Patch Set 2 : add comment, rename variable #

Total comments: 2

Patch Set 3 : rewritten #

Patch Set 4 : caps #

Patch Set 5 : wrap #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+91 lines, -24 lines) Patch
M skia/ext/SkFontHost_fontconfig_direct.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M skia/ext/SkFontHost_fontconfig_direct.cpp View 1 2 3 4 5 chunks +87 lines, -24 lines 1 comment Download

Messages

Total messages: 6 (0 generated)
Evan Martin
10 years, 9 months ago (2010-03-05 01:25:09 UTC) #1
Evan Martin
http://i.imgur.com/YUdJI.png Left to right: 1) with msttcorefonts (looks like Windows) 2) current Chrome without msttcorefonts ...
10 years, 9 months ago (2010-03-05 01:49:24 UTC) #2
agl
LGTM http://codereview.chromium.org/668127/diff/5/1003 File skia/ext/SkFontHost_fontconfig_direct.cpp (right): http://codereview.chromium.org/668127/diff/5/1003#newcode39 skia/ext/SkFontHost_fontconfig_direct.cpp:39: "Arial", "Liberation Sans", "Albany", "Albany AMT", NULL, This ...
10 years, 9 months ago (2010-03-05 16:25:44 UTC) #3
Evan Martin
Ok, rewritten with your idea (minor tweak: class id first so the strings line up ...
10 years, 9 months ago (2010-03-08 18:26:08 UTC) #4
agl
LGTM http://codereview.chromium.org/668127/diff/1015/8 File skia/ext/SkFontHost_fontconfig_direct.cpp (right): http://codereview.chromium.org/668127/diff/1015/8#newcode76 skia/ext/SkFontHost_fontconfig_direct.cpp:76: static const int kClassCount = s/int/size_t/
10 years, 9 months ago (2010-03-08 18:31:40 UTC) #5
Evan Martin
10 years, 9 months ago (2010-03-08 18:37:28 UTC) #6
On 2010/03/08 18:31:40, agl wrote:
> http://codereview.chromium.org/668127/diff/1015/8#newcode76
> skia/ext/SkFontHost_fontconfig_direct.cpp:76: static const int kClassCount =
> s/int/size_t/

Thanks.  I wonder why my compiler isn't complaining about these...

Powered by Google App Engine
This is Rietveld 408576698