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

Unified Diff: content/common/dwrite_font_platform_win.cc

Issue 898403002: win: Hack around Gill Sans Ultra Bold DirectWrite problem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 10 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: content/common/dwrite_font_platform_win.cc
diff --git a/content/common/dwrite_font_platform_win.cc b/content/common/dwrite_font_platform_win.cc
index c2547b5ea323842894728211f92e750a84788c13..b53c754e68f4d1e8413addc8b6dbfce3797ec8c7 100644
--- a/content/common/dwrite_font_platform_win.cc
+++ b/content/common/dwrite_font_platform_win.cc
@@ -84,7 +84,7 @@ const double kArbitraryCacheFileSizeLimit = (30 * 1024 * 1024);
// that file directly from system fonts folder.
const unsigned int kMaxFontFileNameLength = 34;
-const DWORD kCacheFileVersion = 103;
+const DWORD kCacheFileVersion = 104;
scottmg 2015/02/06 19:27:33 shrikant: Is this necessary?
Shrikant Kelkar 2015/02/06 20:56:22 Not necessary in this case.. Registry fonts will b
scottmg 2015/02/06 21:39:33 OK, undid this change.
const DWORD kFileSignature = 0x4D4F5243; // CROM
const DWORD kMagicCompletionSignature = 0x454E4F44; // DONE
@@ -773,7 +773,25 @@ bool FontCollectionLoader::LoadFontListFromRegistry() {
value.size() < kMaxFontFileNameLength - 1) ||
base::FilePath::CompareEqualIgnoreCase(system_font_path.value(),
path.DirName().value())) {
- reg_fonts_.push_back(value.c_str());
+ // "Gill Sans Ultra Bold" turns into an Ultra Bold weight "Gill Sans"
+ // in DirectWrite, but most users don't have any other weights. The
+ // regular weight font is named "Gill Sans MT", but that ends up in a
+ // different family with that name. On Mac, there's a "Gill Sans" with
+ // various weights, so CSS authors use { 'font-family': 'Gill Sans',
+ // 'Gill Sans MT', ... } and because of the DirectWrite family futzing,
+ // they end up with an Ultra Bold font, when they just wanted "Gill
+ // Sans". Mozilla implemented a more complicated hack where they
+ // effectively rename the Ultra Bold font to "Gill Sans MT Ultra Bold",
+ // but because the Ultra Bold font is so ugly anyway, we simply ignore
+ // it. See http://www.microsoft.com/typography/fonts/font.aspx?FMID=978
+ // for a picture of the font, and the file name. We also ignore "Gill
+ // Sans Ultra Bold Condensed".
+ if (!base::FilePath::CompareEqualIgnoreCase(
+ path.value(), FILE_PATH_LITERAL("gilsanub.ttf")) &&
+ !base::FilePath::CompareEqualIgnoreCase(
+ path.value(), FILE_PATH_LITERAL("gillubcd.ttf"))) {
Shrikant Kelkar 2015/02/06 20:56:22 Since more than one, please consider using fonts_t
scottmg 2015/02/06 21:39:33 Done.
+ reg_fonts_.push_back(value.c_str());
+ }
}
}
}
« 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