Title: [220117] trunk/Source/WebCore
Revision
220117
Author
[email protected]
Date
2017-08-01 18:08:48 -0700 (Tue, 01 Aug 2017)

Log Message

[WinCairo] Implement Font::platformBoundsForGlyph
https://bugs.webkit.org/show_bug.cgi?id=174813

Patch by Fujii Hironori <[email protected]> on 2017-08-01
Reviewed by Alex Christensen.

Test: fast/text/emphasis.html

* platform/graphics/win/SimpleFontDataCairoWin.cpp:
(WebCore::Font::platformBoundsForGlyph): Implemented by copying
the code from Font::boundsForGDIGlyph().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220116 => 220117)


--- trunk/Source/WebCore/ChangeLog	2017-08-02 00:36:05 UTC (rev 220116)
+++ trunk/Source/WebCore/ChangeLog	2017-08-02 01:08:48 UTC (rev 220117)
@@ -1,3 +1,16 @@
+2017-08-01  Fujii Hironori  <[email protected]>
+
+        [WinCairo] Implement Font::platformBoundsForGlyph
+        https://bugs.webkit.org/show_bug.cgi?id=174813
+
+        Reviewed by Alex Christensen.
+
+        Test: fast/text/emphasis.html
+
+        * platform/graphics/win/SimpleFontDataCairoWin.cpp:
+        (WebCore::Font::platformBoundsForGlyph): Implemented by copying
+        the code from Font::boundsForGDIGlyph().
+
 2017-08-01  Zalan Bujtas  <[email protected]>
 
         REGRESSION (r217197): New Yorker website hangs for a long time on load, lots of blank tiles

Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp (220116 => 220117)


--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp	2017-08-02 00:36:05 UTC (rev 220116)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp	2017-08-02 01:08:48 UTC (rev 220117)
@@ -109,8 +109,20 @@
 {
     if (m_platformData.useGDI())
         return boundsForGDIGlyph(glyph);
-    //FIXME: Implement this
-    return FloatRect();
+
+    HWndDC dc(0);
+    SaveDC(dc);
+    auto scaledFont = m_platformData.scaledFont();
+    cairo_win32_scaled_font_select_font(scaledFont, dc);
+
+    GLYPHMETRICS gdiMetrics;
+    static const MAT2 identity = { 0, 1,  0, 0,  0, 0,  0, 1 };
+    GetGlyphOutline(dc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity);
+
+    cairo_win32_scaled_font_done_font(scaledFont);
+    RestoreDC(dc, -1);
+    return FloatRect(gdiMetrics.gmptGlyphOrigin.x, -gdiMetrics.gmptGlyphOrigin.y,
+        gdiMetrics.gmBlackBoxX + m_syntheticBoldOffset, gdiMetrics.gmBlackBoxY);
 }
     
 float Font::platformWidthForGlyph(Glyph glyph) const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to