Title: [246831] trunk/Source/WebCore
- Revision
- 246831
- Author
- [email protected]
- Date
- 2019-06-25 20:51:59 -0700 (Tue, 25 Jun 2019)
Log Message
[WinCairo] incorrect font height for 'Google Sans Display' font
https://bugs.webkit.org/show_bug.cgi?id=198909
Reviewed by Frédéric Wang.
r191893 changed to use OS/2 typo metrics, but its calculation
wasn't correct. And, there is no reliable way to get OS/2 table by
using Windows API. Revert the part of r191893 change at the
moment.
* platform/graphics/win/SimpleFontDataCairoWin.cpp:
(WebCore::Font::platformInit):
* platform/graphics/win/SimpleFontDataWin.cpp:
(WebCore::Font::initGDIFont):
Reverted the part of r191893 change, and added FIXME comments.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (246830 => 246831)
--- trunk/Source/WebCore/ChangeLog 2019-06-26 03:49:16 UTC (rev 246830)
+++ trunk/Source/WebCore/ChangeLog 2019-06-26 03:51:59 UTC (rev 246831)
@@ -1,3 +1,21 @@
+2019-06-25 Fujii Hironori <[email protected]>
+
+ [WinCairo] incorrect font height for 'Google Sans Display' font
+ https://bugs.webkit.org/show_bug.cgi?id=198909
+
+ Reviewed by Frédéric Wang.
+
+ r191893 changed to use OS/2 typo metrics, but its calculation
+ wasn't correct. And, there is no reliable way to get OS/2 table by
+ using Windows API. Revert the part of r191893 change at the
+ moment.
+
+ * platform/graphics/win/SimpleFontDataCairoWin.cpp:
+ (WebCore::Font::platformInit):
+ * platform/graphics/win/SimpleFontDataWin.cpp:
+ (WebCore::Font::initGDIFont):
+ Reverted the part of r191893 change, and added FIXME comments.
+
2019-06-25 Timothy Hatcher <[email protected]>
Clicking the up/down spin buttons for a number input increments/decrements by 2.
Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp (246830 => 246831)
--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp 2019-06-26 03:49:16 UTC (rev 246830)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp 2019-06-26 03:51:59 UTC (rev 246831)
@@ -67,23 +67,13 @@
cairo_win32_scaled_font_select_font(scaledFont, dc);
- OUTLINETEXTMETRIC metrics;
- GetOutlineTextMetrics(dc, sizeof(metrics), &metrics);
- TEXTMETRIC& textMetrics = metrics.otmTextMetrics;
- float ascent, descent, lineGap;
- // The Open Font Format describes the OS/2 USE_TYPO_METRICS flag as follows:
- // "If set, it is strongly recommended to use OS/2.sTypoAscender - OS/2.sTypoDescender+ OS/2.sTypoLineGap as a value for default line spacing for this font."
- const UINT useTypoMetricsMask = 1 << 7;
- if (metrics.otmfsSelection & useTypoMetricsMask) {
- ascent = metrics.otmAscent * metricsMultiplier;
- descent = metrics.otmDescent * metricsMultiplier;
- lineGap = metrics.otmLineGap * metricsMultiplier;
- } else {
- ascent = textMetrics.tmAscent * metricsMultiplier;
- descent = textMetrics.tmDescent * metricsMultiplier;
- lineGap = textMetrics.tmExternalLeading * metricsMultiplier;
- }
- float xHeight = ascent * 0.56f; // Best guess for xHeight for non-Truetype fonts.
+ // FIXME: Needs to take OS/2 USE_TYPO_METRICS flag into account
+ // https://bugs.webkit.org/show_bug.cgi?id=199186
+ TEXTMETRIC textMetrics;
+ GetTextMetrics(dc, &textMetrics);
+ float ascent = textMetrics.tmAscent * metricsMultiplier;
+ float descent = textMetrics.tmDescent * metricsMultiplier;
+ float lineGap = textMetrics.tmExternalLeading * metricsMultiplier;
m_fontMetrics.setAscent(ascent);
m_fontMetrics.setDescent(descent);
@@ -94,7 +84,7 @@
cairo_text_extents_t extents;
cairo_scaled_font_text_extents(scaledFont, "x", &extents);
- xHeight = -extents.y_bearing;
+ float xHeight = -extents.y_bearing;
m_fontMetrics.setXHeight(xHeight);
cairo_win32_scaled_font_done_font(scaledFont);
Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp (246830 => 246831)
--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2019-06-26 03:49:16 UTC (rev 246830)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2019-06-26 03:51:59 UTC (rev 246831)
@@ -87,19 +87,11 @@
OUTLINETEXTMETRIC metrics;
GetOutlineTextMetrics(hdc, sizeof(metrics), &metrics);
TEXTMETRIC& textMetrics = metrics.otmTextMetrics;
- float ascent, descent, lineGap;
- // The Open Font Format describes the OS/2 USE_TYPO_METRICS flag as follows:
- // "If set, it is strongly recommended to use OS/2.sTypoAscender - OS/2.sTypoDescender+ OS/2.sTypoLineGap as a value for default line spacing for this font."
- const UINT useTypoMetricsMask = 1 << 7;
- if (metrics.otmfsSelection & useTypoMetricsMask) {
- ascent = metrics.otmAscent;
- descent = metrics.otmDescent;
- lineGap = metrics.otmLineGap;
- } else {
- ascent = textMetrics.tmAscent;
- descent = textMetrics.tmDescent;
- lineGap = textMetrics.tmExternalLeading;
- }
+ // FIXME: Needs to take OS/2 USE_TYPO_METRICS flag into account
+ // https://bugs.webkit.org/show_bug.cgi?id=199186
+ float ascent = textMetrics.tmAscent;
+ float descent = textMetrics.tmDescent;
+ float lineGap = textMetrics.tmExternalLeading;
m_fontMetrics.setAscent(ascent);
m_fontMetrics.setDescent(descent);
m_fontMetrics.setLineGap(lineGap);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes