Alexandre Julliard : gdi32: Fix positioning of font underlines and strikeouts.
Alexandre Julliard
julliard at winehq.org
Mon Nov 7 13:30:41 CST 2011
Module: wine
Branch: master
Commit: 199409a27bb405774d2837c176098f02c58fea75
URL: http://source.winehq.org/git/wine.git/?a=commit;h=199409a27bb405774d2837c176098f02c58fea75
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Nov 7 13:41:18 2011 +0100
gdi32: Fix positioning of font underlines and strikeouts.
---
dlls/gdi32/font.c | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 10a7f1d..97cc2b6 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -2095,20 +2095,23 @@ done:
{
otm = HeapAlloc(GetProcessHeap(), 0, size);
GetOutlineTextMetricsW(hdc, size, otm);
- underlinePos = otm->otmsUnderscorePosition;
- underlineWidth = otm->otmsUnderscoreSize;
- strikeoutPos = otm->otmsStrikeoutPosition;
- strikeoutWidth = otm->otmsStrikeoutSize;
+ underlinePos = abs( INTERNAL_YWSTODS( dc, otm->otmsUnderscorePosition ));
+ if (otm->otmsUnderscorePosition < 0) underlinePos = -underlinePos;
+ underlineWidth = abs( INTERNAL_YWSTODS( dc, otm->otmsUnderscoreSize ));
+ if (otm->otmsUnderscoreSize < 0) underlineWidth = -underlineWidth;
+ strikeoutPos = abs( INTERNAL_YWSTODS( dc, otm->otmsStrikeoutPosition ));
+ if (otm->otmsStrikeoutPosition < 0) strikeoutPos = -strikeoutPos;
+ strikeoutWidth = abs( INTERNAL_YWSTODS( dc, otm->otmsStrikeoutSize ));
HeapFree(GetProcessHeap(), 0, otm);
}
if (lf.lfUnderline)
{
- pts[0].x = x - underlinePos * sinEsc;
- pts[0].y = y - underlinePos * cosEsc;
- pts[1].x = x + width.x - underlinePos * sinEsc;
- pts[1].y = y + width.y - underlinePos * cosEsc;
+ pts[0].x = x - (underlinePos + underlineWidth / 2) * sinEsc;
+ pts[0].y = y - (underlinePos + underlineWidth / 2) * cosEsc;
+ pts[1].x = x + width.x - (underlinePos + underlineWidth / 2) * sinEsc;
+ pts[1].y = y + width.y - (underlinePos + underlineWidth / 2) * cosEsc;
pts[2].x = pts[1].x + underlineWidth * sinEsc;
pts[2].y = pts[1].y + underlineWidth * cosEsc;
pts[3].x = pts[0].x + underlineWidth * sinEsc;
@@ -2121,10 +2124,10 @@ done:
if (lf.lfStrikeOut)
{
- pts[0].x = x - strikeoutPos * sinEsc;
- pts[0].y = y - strikeoutPos * cosEsc;
- pts[1].x = x + width.x - strikeoutPos * sinEsc;
- pts[1].y = y + width.y - strikeoutPos * cosEsc;
+ pts[0].x = x - (strikeoutPos + strikeoutWidth / 2) * sinEsc;
+ pts[0].y = y - (strikeoutPos + strikeoutWidth / 2) * cosEsc;
+ pts[1].x = x + width.x - (strikeoutPos + strikeoutWidth / 2) * sinEsc;
+ pts[1].y = y + width.y - (strikeoutPos + strikeoutWidth / 2) * cosEsc;
pts[2].x = pts[1].x + strikeoutWidth * sinEsc;
pts[2].y = pts[1].y + strikeoutWidth * cosEsc;
pts[3].x = pts[0].x + strikeoutWidth * sinEsc;
More information about the wine-cvs
mailing list