Changeset 246831 in webkit
- Timestamp:
- Jun 25, 2019 8:51:59 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r246818 r246831 1 2019-06-25 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 [WinCairo] incorrect font height for 'Google Sans Display' font 4 https://bugs.webkit.org/show_bug.cgi?id=198909 5 6 Reviewed by Frédéric Wang. 7 8 r191893 changed to use OS/2 typo metrics, but its calculation 9 wasn't correct. And, there is no reliable way to get OS/2 table by 10 using Windows API. Revert the part of r191893 change at the 11 moment. 12 13 * platform/graphics/win/SimpleFontDataCairoWin.cpp: 14 (WebCore::Font::platformInit): 15 * platform/graphics/win/SimpleFontDataWin.cpp: 16 (WebCore::Font::initGDIFont): 17 Reverted the part of r191893 change, and added FIXME comments. 18 1 19 2019-06-25 Timothy Hatcher <timothy@apple.com> 2 20 -
trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
r239320 r246831 68 68 cairo_win32_scaled_font_select_font(scaledFont, dc); 69 69 70 OUTLINETEXTMETRIC metrics; 71 GetOutlineTextMetrics(dc, sizeof(metrics), &metrics); 72 TEXTMETRIC& textMetrics = metrics.otmTextMetrics; 73 float ascent, descent, lineGap; 74 // The Open Font Format describes the OS/2 USE_TYPO_METRICS flag as follows: 75 // "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." 76 const UINT useTypoMetricsMask = 1 << 7; 77 if (metrics.otmfsSelection & useTypoMetricsMask) { 78 ascent = metrics.otmAscent * metricsMultiplier; 79 descent = metrics.otmDescent * metricsMultiplier; 80 lineGap = metrics.otmLineGap * metricsMultiplier; 81 } else { 82 ascent = textMetrics.tmAscent * metricsMultiplier; 83 descent = textMetrics.tmDescent * metricsMultiplier; 84 lineGap = textMetrics.tmExternalLeading * metricsMultiplier; 85 } 86 float xHeight = ascent * 0.56f; // Best guess for xHeight for non-Truetype fonts. 70 // FIXME: Needs to take OS/2 USE_TYPO_METRICS flag into account 71 // https://bugs.webkit.org/show_bug.cgi?id=199186 72 TEXTMETRIC textMetrics; 73 GetTextMetrics(dc, &textMetrics); 74 float ascent = textMetrics.tmAscent * metricsMultiplier; 75 float descent = textMetrics.tmDescent * metricsMultiplier; 76 float lineGap = textMetrics.tmExternalLeading * metricsMultiplier; 87 77 88 78 m_fontMetrics.setAscent(ascent); … … 95 85 cairo_text_extents_t extents; 96 86 cairo_scaled_font_text_extents(scaledFont, "x", &extents); 97 xHeight = -extents.y_bearing;87 float xHeight = -extents.y_bearing; 98 88 99 89 m_fontMetrics.setXHeight(xHeight); -
trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
r239320 r246831 88 88 GetOutlineTextMetrics(hdc, sizeof(metrics), &metrics); 89 89 TEXTMETRIC& textMetrics = metrics.otmTextMetrics; 90 float ascent, descent, lineGap; 91 // The Open Font Format describes the OS/2 USE_TYPO_METRICS flag as follows: 92 // "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." 93 const UINT useTypoMetricsMask = 1 << 7; 94 if (metrics.otmfsSelection & useTypoMetricsMask) { 95 ascent = metrics.otmAscent; 96 descent = metrics.otmDescent; 97 lineGap = metrics.otmLineGap; 98 } else { 99 ascent = textMetrics.tmAscent; 100 descent = textMetrics.tmDescent; 101 lineGap = textMetrics.tmExternalLeading; 102 } 90 // FIXME: Needs to take OS/2 USE_TYPO_METRICS flag into account 91 // https://bugs.webkit.org/show_bug.cgi?id=199186 92 float ascent = textMetrics.tmAscent; 93 float descent = textMetrics.tmDescent; 94 float lineGap = textMetrics.tmExternalLeading; 103 95 m_fontMetrics.setAscent(ascent); 104 96 m_fontMetrics.setDescent(descent);
Note: See TracChangeset
for help on using the changeset viewer.