Index: Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm |
diff --git a/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm b/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm |
index b7b8f756fe30a5dd845d4418487cec8a7505a20e..b56cae5a9357b71a9d60d37383c3315999f8e6d1 100644 |
--- a/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm |
+++ b/Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm |
@@ -28,9 +28,13 @@ |
#import <AvailabilityMacros.h> |
#import <wtf/text/WTFString.h> |
+#include "platform/LayoutTestSupport.h" |
+#include "platform/RuntimeEnabledFeatures.h" |
#import "platform/fonts/harfbuzz/HarfBuzzFace.h" |
#include "third_party/skia/include/ports/SkTypeface_mac.h" |
+ |
+ |
namespace blink { |
unsigned FontPlatformData::hash() const |
@@ -40,6 +44,28 @@ unsigned FontPlatformData::hash() const |
return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes); |
} |
+void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext*) const |
+{ |
+ bool shouldSmoothFonts = true; |
+ bool shouldAntialias = true; |
+ |
+ shouldAntialias = shouldAntialias && (!LayoutTestSupport::isRunningLayoutTest() || LayoutTestSupport::isFontAntialiasingEnabledForTest()); |
eae
2014/09/26 14:32:08
Nit: you might want to wrap this line.
|
+ bool useSubpixelText = RuntimeEnabledFeatures::subpixelFontScalingEnabled(); |
+ shouldSmoothFonts = shouldSmoothFonts && !LayoutTestSupport::isRunningLayoutTest(); |
+ |
+ paint->setAntiAlias(shouldAntialias); |
+ paint->setEmbeddedBitmapText(false); |
+ const float ts = m_textSize >= 0 ? m_textSize : 12; |
+ paint->setTextSize(SkFloatToScalar(ts)); |
+ paint->setTypeface(typeface()); |
+ paint->setFakeBoldText(m_syntheticBold); |
+ paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0); |
+ paint->setAutohinted(false); // freetype specific |
+ paint->setLCDRenderText(shouldSmoothFonts); |
+ paint->setSubpixelText(useSubpixelText); |
+ paint->setHinting(SkPaint::kNo_Hinting); |
+} |
+ |
// These CoreText Text Spacing feature selectors are not defined in CoreText. |
enum TextSpacingCTFeatureSelector { TextSpacingProportional, TextSpacingFullWidth, TextSpacingHalfWidth, TextSpacingThirdWidth, TextSpacingQuarterWidth }; |
@@ -264,19 +290,4 @@ CTFontRef FontPlatformData::ctFont() const |
return m_CTFont.get(); |
} |
-bool FontPlatformData::isAATFont(CTFontRef ctFont) const |
-{ |
- CFDataRef table = CTFontCopyTable(ctFont, kCTFontTableMort, 0); |
- if (table) { |
- CFRelease(table); |
- return true; |
- } |
- table = CTFontCopyTable(ctFont, kCTFontTableMorx, 0); |
- if (table) { |
- CFRelease(table); |
- return true; |
- } |
- return false; |
-} |
- |
} // namespace blink |