Index: Source/platform/fonts/win/FontCacheSkiaWin.cpp |
diff --git a/Source/platform/fonts/win/FontCacheSkiaWin.cpp b/Source/platform/fonts/win/FontCacheSkiaWin.cpp |
index b6dde3176083df54eac3c9dcb5602c9c22fda770..a2c9a6aef009a7f7705c83979ae7e631e6266fcb 100644 |
--- a/Source/platform/fonts/win/FontCacheSkiaWin.cpp |
+++ b/Source/platform/fonts/win/FontCacheSkiaWin.cpp |
@@ -76,7 +76,9 @@ FontCache::FontCache() |
// Given the desired base font, this will create a SimpleFontData for a specific |
// font that can be used to render the given range of characters. |
-PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescription& fontDescription, UChar32 character, const SimpleFontData*) |
+PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( |
+ const FontDescription& fontDescription, UChar32 character, |
+ const SimpleFontData* originalFontData) |
{ |
// First try the specified font with standard style & weight. |
if (fontDescription.style() == FontStyleItalic |
@@ -161,6 +163,15 @@ PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescrip |
data = getFontPlatformData(fontDescription, createByFamily); |
} |
+ // For font fallback we want to match the subpixel behavior of the original |
+ // font. Mixing subpixel and non-subpixel in the same text run looks really |
+ // odd and causes problems with preferred width calculations. |
+ if (data && originalFontData) { |
+ const FontPlatformData& platformData = originalFontData->platformData(); |
+ data->setMinSizeForAntiAlias(platformData.minSizeForAntiAlias()); |
+ data->setMinSizeForSubpixel(platformData.minSizeForSubpixel()); |
+ } |
+ |
// When i-th font (0-base) in |panUniFonts| contains a character and |
// we get out of the loop, |i| will be |i + 1|. That is, if only the |
// last font in the array covers the character, |i| will be numFonts. |