Chromium Code Reviews| Index: Source/platform/fonts/mac/SimpleFontDataMac.mm |
| diff --git a/Source/platform/fonts/mac/SimpleFontDataMac.mm b/Source/platform/fonts/mac/SimpleFontDataMac.mm |
| index 5586030251754e8d0c7decee790aa8ca5e11a5d7..ee6ac00f00cbac9bc8a03ab729b10ad99f53b883 100644 |
| --- a/Source/platform/fonts/mac/SimpleFontDataMac.mm |
| +++ b/Source/platform/fonts/mac/SimpleFontDataMac.mm |
| @@ -31,6 +31,8 @@ |
| #import <ApplicationServices/ApplicationServices.h> |
| #import <float.h> |
| #import <unicode/uchar.h> |
| +#import "RuntimeEnabledFeatures.h" |
| +#import "platform/LayoutTestSupport.h" |
| #import "platform/SharedBuffer.h" |
| #import "platform/fonts/Font.h" |
| #import "platform/fonts/FontCache.h" |
| @@ -106,6 +108,14 @@ static NSString *webFallbackFontFamily(void) |
| return webFallbackFontFamily.get(); |
| } |
| +static bool useHinting() |
| +{ |
| + // Enable hinting when subpixel font scaling is disabled or |
| + // when running the set of standard non-subpixel layout tests, |
| + // otherwise use subpixel glyph positioning. |
| + return (isRunningLayoutTest() && !isFontAntialiasingEnabledForTest()) || !RuntimeEnabledFeatures::subpixelFontScalingEnabled(); |
| +} |
| + |
| const SimpleFontData* SimpleFontData::getCompositeFontReferenceFontData(NSFont *key) const |
| { |
| if (key && !CFEqual(RetainPtr<CFStringRef>(AdoptCF, CTFontCopyPostScriptName(CTFontRef(key))).get(), CFSTR("LastResort"))) { |
| @@ -315,9 +325,8 @@ PassRefPtr<SimpleFontData> SimpleFontData::platformCreateScaledFontData(const Fo |
| float size = m_platformData.size() * scaleFactor; |
| FontPlatformData scaledFontData([[NSFontManager sharedFontManager] convertFont:m_platformData.font() toSize:size], size, false, false, m_platformData.orientation()); |
| - // Until we replace AppKit API (NSFontManager etc.), we always want to disable hinting, |
| - // so we use the printerFont here. |
| - scaledFontData.setFont([scaledFontData.font() printerFont]); |
| + // AppKit forgets about hinting property when scaling, so we have to remind it. |
| + scaledFontData.setFont(useHinting() ? [scaledFontData.font() screenFont] : [scaledFontData.font() printerFont]); |
|
Dominik Röttsches
2014/05/28 14:33:51
This part should have been in the previous patch f
|
| if (scaledFontData.font()) { |
| NSFontManager *fontManager = [NSFontManager sharedFontManager]; |