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

Unified Diff: third_party/WebKit/Source/platform/fonts/FontCache.cpp

Issue 2721613002: Fix matching Roboto Bold for src: local("Roboto Regular") (Closed)
Patch Set: Fix test case for Mac Created 3 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
Index: third_party/WebKit/Source/platform/fonts/FontCache.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
index d5a4e3da6628a96b4d502c20ff72b24dc3bafb89..9208ac4499d472e7050295c73f450646bdf44527 100644
--- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
@@ -172,7 +172,7 @@ FontPlatformData* FontCache::getFontPlatformData(
foundResult = result || !addResult.isNewEntry;
}
- if (!foundResult && alternateFontName != AlternateFontName::NoAlternate &&
+ if (!foundResult && alternateFontName == AlternateFontName::AllowAlternate &&
creationParams.creationType() == CreateFontByFamily) {
// We were unable to find a font. We have a small set of fonts that we alias
// to other names, e.g., Arial/Helvetica, Courier/Courier New, etc. Try
@@ -296,14 +296,23 @@ PassRefPtr<SimpleFontData> FontCache::fontDataFromFontPlatformData(
return gFontDataCache->get(platformData, shouldRetain, subpixelAscentDescent);
}
-bool FontCache::isPlatformFontAvailable(const FontDescription& fontDescription,
- const AtomicString& family) {
+bool FontCache::isPlatformFamilyMatchAvailable(
+ const FontDescription& fontDescription,
+ const AtomicString& family) {
return getFontPlatformData(
fontDescription,
FontFaceCreationParams(adjustFamilyNameToAvoidUnsupportedFonts(family)),
AlternateFontName::NoAlternate);
}
+bool FontCache::isPlatformFontUniqueNameMatchAvailable(
+ const FontDescription& fontDescription,
+ const AtomicString& uniqueFontName) {
+ return getFontPlatformData(fontDescription,
+ FontFaceCreationParams(uniqueFontName),
+ AlternateFontName::LocalUniqueFace);
+}
+
String FontCache::firstAvailableOrFirst(const String& families) {
// The conversions involve at least two string copies, and more if non-ASCII.
// For now we prefer shared code over the cost because a) inputs are

Powered by Google App Engine
This is Rietveld 408576698