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

Unified Diff: Source/platform/fonts/mac/SimpleFontDataMac.mm

Issue 304723002: Gate subpixel scaling by RuntimeEnabledFeatures::subpixelFontScalingEnabled() on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 | « Source/platform/fonts/mac/FontCacheMac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
« no previous file with comments | « Source/platform/fonts/mac/FontCacheMac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698