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

Unified Diff: Source/platform/fonts/cocoa/FontPlatformDataCocoa.mm

Issue 175253002: Switch to HarfBuzz on Mac and remove CoreText shaper (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fighting trunk TestExpectation changes Created 6 years, 3 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/FontPlatformData.cpp ('k') | Source/platform/fonts/harfbuzz/HarfBuzzFaceCoreText.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..71200f3634833bd6093686985b793d02996e4750 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,29 @@ 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());
+ 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 +291,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
« no previous file with comments | « Source/platform/fonts/FontPlatformData.cpp ('k') | Source/platform/fonts/harfbuzz/HarfBuzzFaceCoreText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698