Title: [167679] trunk
- Revision
- 167679
- Author
- [email protected]
- Date
- 2014-04-22 13:38:00 -0700 (Tue, 22 Apr 2014)
Log Message
[OS X] Glyph spacing for system fonts may be incorrect
https://bugs.webkit.org/show_bug.cgi?id=131967
Reviewed by Simon Fraser.
Source/WebCore:
Covered by existing tests.
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::platformWidthForGlyph): Update to use CTFontGetAdvancesForGlyphs() for system fonts
(WebCore::hasCustomTracking):
LayoutTests:
Updating test to be more robust.
* fast/forms/search/intrinsic-search-width-with-decoration-border-padding-expected.txt:
* fast/forms/search/intrinsic-search-width-with-decoration-border-padding.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (167678 => 167679)
--- trunk/LayoutTests/ChangeLog 2014-04-22 20:31:47 UTC (rev 167678)
+++ trunk/LayoutTests/ChangeLog 2014-04-22 20:38:00 UTC (rev 167679)
@@ -1,3 +1,15 @@
+2014-04-21 Myles C. Maxfield <[email protected]>
+
+ [OS X] Glyph spacing for system fonts may be incorrect
+ https://bugs.webkit.org/show_bug.cgi?id=131967
+
+ Reviewed by Simon Fraser.
+
+ Updating test to be more robust.
+
+ * fast/forms/search/intrinsic-search-width-with-decoration-border-padding-expected.txt:
+ * fast/forms/search/intrinsic-search-width-with-decoration-border-padding.html:
+
2014-04-22 Manuel Rego Casasnovas <[email protected]>
REGRESSION (r167652): Broke fast/regions/cssom/region-range-for-box-crash.html in debug mode
Modified: trunk/LayoutTests/fast/forms/search/intrinsic-search-width-with-decoration-border-padding-expected.txt (167678 => 167679)
--- trunk/LayoutTests/fast/forms/search/intrinsic-search-width-with-decoration-border-padding-expected.txt 2014-04-22 20:31:47 UTC (rev 167678)
+++ trunk/LayoutTests/fast/forms/search/intrinsic-search-width-with-decoration-border-padding-expected.txt 2014-04-22 20:38:00 UTC (rev 167679)
@@ -3,3 +3,4 @@
TEST COMPLETE
+
Modified: trunk/LayoutTests/fast/forms/search/intrinsic-search-width-with-decoration-border-padding.html (167678 => 167679)
--- trunk/LayoutTests/fast/forms/search/intrinsic-search-width-with-decoration-border-padding.html 2014-04-22 20:31:47 UTC (rev 167678)
+++ trunk/LayoutTests/fast/forms/search/intrinsic-search-width-with-decoration-border-padding.html 2014-04-22 20:38:00 UTC (rev 167679)
@@ -13,6 +13,7 @@
<script src=""
<input type="search" id="search1">
+<br/>
<input type="search" id="search2">
<script>
shouldBe('document.getElementById("search1").offsetWidth', 'document.getElementById("search2").offsetWidth');
Modified: trunk/Source/WebCore/ChangeLog (167678 => 167679)
--- trunk/Source/WebCore/ChangeLog 2014-04-22 20:31:47 UTC (rev 167678)
+++ trunk/Source/WebCore/ChangeLog 2014-04-22 20:38:00 UTC (rev 167679)
@@ -1,3 +1,16 @@
+2014-04-21 Myles C. Maxfield <[email protected]>
+
+ [OS X] Glyph spacing for system fonts may be incorrect
+ https://bugs.webkit.org/show_bug.cgi?id=131967
+
+ Reviewed by Simon Fraser.
+
+ Covered by existing tests.
+
+ * platform/graphics/mac/SimpleFontDataMac.mm:
+ (WebCore::SimpleFontData::platformWidthForGlyph): Update to use CTFontGetAdvancesForGlyphs() for system fonts
+ (WebCore::hasCustomTracking):
+
2014-04-22 David Hyatt <[email protected]>
[New Multicolumn] widows/orphans cause assertion failures.
Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm (167678 => 167679)
--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm 2014-04-22 20:31:47 UTC (rev 167678)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm 2014-04-22 20:38:00 UTC (rev 167679)
@@ -47,6 +47,12 @@
#import <wtf/StdLibExtras.h>
#import <wtf/RetainPtr.h>
+#if defined(__has_include) && __has_include(<CoreText/CTFontDescriptorPriv.h>)
+#import <CoreText/CTFontDescriptorPriv.h>
+#endif
+
+extern "C" bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
+
#if !PLATFORM(IOS)
@interface NSFont (WebAppKitSecretAPI)
- (BOOL)_isFakeFixedPitch;
@@ -359,11 +365,23 @@
return boundingBox;
}
+static bool hasCustomTracking(CTFontRef font)
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1090
+ UNUSED_PARAM(font);
+ return false;
+#else
+ RetainPtr<CTFontDescriptorRef> descriptor = CTFontCopyFontDescriptor(font);
+ return CTFontDescriptorIsSystemUIFont(descriptor.get())
+#endif
+}
+
#if !PLATFORM(IOS)
float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
{
CGSize advance = CGSizeZero;
- if (platformData().orientation() == Horizontal || m_isBrokenIdeographFallback) {
+ bool horizontal = platformData().orientation() == Horizontal;
+ if ((horizontal || m_isBrokenIdeographFallback) && !hasCustomTracking(m_platformData.ctFont())) {
NSFont *font = platformData().font();
if (font && platformData().isColorBitmapFont())
advance = NSSizeToCGSize([font advancementForGlyph:glyph]);
@@ -376,7 +394,7 @@
}
}
} else
- CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), kCTFontVerticalOrientation, &glyph, &advance, 1);
+ CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), horizontal ? kCTFontHorizontalOrientation : kCTFontVerticalOrientation, &glyph, &advance, 1);
return advance.width + m_syntheticBoldOffset;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes