Module: wine Branch: master Commit: 0c1f32905335f9fe8fbba90fa2d8de940ba9412a URL: http://source.winehq.org/git/wine.git/?a=commit;h=0c1f32905335f9fe8fbba90fa2...
Author: Huw Davies huw@codeweavers.com Date: Tue May 19 08:58:24 2015 +0100
gdi32: Prevent the underline / strikeout width getting rounded to zero.
---
dlls/gdi32/font.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 8f52053..40ba7e7 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -2109,6 +2109,18 @@ BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags, return ret; }
+/*********************************************************************** + * get_line_width + * + * Scale the underline / strikeout line width. + */ +static inline int get_line_width( DC *dc, int metric_size ) +{ + int width = abs( INTERNAL_YWSTODS( dc, metric_size )); + if (width == 0) width = 1; + if (metric_size < 0) width = -width; + return width; +}
/*********************************************************************** * ExtTextOutW (GDI32.@) @@ -2473,11 +2485,10 @@ done: GetOutlineTextMetricsW(hdc, size, otm); 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; + underlineWidth = get_line_width( dc, otm->otmsUnderscoreSize ); strikeoutPos = abs( INTERNAL_YWSTODS( dc, otm->otmsStrikeoutPosition )); if (otm->otmsStrikeoutPosition < 0) strikeoutPos = -strikeoutPos; - strikeoutWidth = abs( INTERNAL_YWSTODS( dc, otm->otmsStrikeoutSize )); + strikeoutWidth = get_line_width( dc, otm->otmsStrikeoutSize ); HeapFree(GetProcessHeap(), 0, otm); }