Commit 0c1f3290 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Prevent the underline / strikeout width getting rounded to zero.

parent 0940ce32
...@@ -2109,6 +2109,18 @@ BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags, ...@@ -2109,6 +2109,18 @@ BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags,
return ret; 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.@) * ExtTextOutW (GDI32.@)
...@@ -2473,11 +2485,10 @@ done: ...@@ -2473,11 +2485,10 @@ done:
GetOutlineTextMetricsW(hdc, size, otm); GetOutlineTextMetricsW(hdc, size, otm);
underlinePos = abs( INTERNAL_YWSTODS( dc, otm->otmsUnderscorePosition )); underlinePos = abs( INTERNAL_YWSTODS( dc, otm->otmsUnderscorePosition ));
if (otm->otmsUnderscorePosition < 0) underlinePos = -underlinePos; if (otm->otmsUnderscorePosition < 0) underlinePos = -underlinePos;
underlineWidth = abs( INTERNAL_YWSTODS( dc, otm->otmsUnderscoreSize )); underlineWidth = get_line_width( dc, otm->otmsUnderscoreSize );
if (otm->otmsUnderscoreSize < 0) underlineWidth = -underlineWidth;
strikeoutPos = abs( INTERNAL_YWSTODS( dc, otm->otmsStrikeoutPosition )); strikeoutPos = abs( INTERNAL_YWSTODS( dc, otm->otmsStrikeoutPosition ));
if (otm->otmsStrikeoutPosition < 0) strikeoutPos = -strikeoutPos; if (otm->otmsStrikeoutPosition < 0) strikeoutPos = -strikeoutPos;
strikeoutWidth = abs( INTERNAL_YWSTODS( dc, otm->otmsStrikeoutSize )); strikeoutWidth = get_line_width( dc, otm->otmsStrikeoutSize );
HeapFree(GetProcessHeap(), 0, otm); HeapFree(GetProcessHeap(), 0, otm);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment