Draw underline and strikeout for ExtTextOut on an open path using
Polygon to more closely mimic what Windows does.
This commit is contained in:
parent
b55060844b
commit
cc748043cd
@ -2060,8 +2060,6 @@ done:
|
|||||||
|
|
||||||
if(!size)
|
if(!size)
|
||||||
{
|
{
|
||||||
TEXTMETRICW tm;
|
|
||||||
GetTextMetricsW(hdc, &tm);
|
|
||||||
underlinePos = 0;
|
underlinePos = 0;
|
||||||
underlineWidth = tm.tmAscent / 20 + 1;
|
underlineWidth = tm.tmAscent / 20 + 1;
|
||||||
strikeoutPos = tm.tmAscent / 2;
|
strikeoutPos = tm.tmAscent / 2;
|
||||||
@ -2078,10 +2076,59 @@ done:
|
|||||||
HeapFree(GetProcessHeap(), 0, otm);
|
HeapFree(GetProcessHeap(), 0, otm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PATH_IsPathOpen(dc->path))
|
||||||
|
{
|
||||||
|
POINT pts[5];
|
||||||
|
HPEN hpen;
|
||||||
|
HBRUSH hbrush = CreateSolidBrush(GetTextColor(hdc));
|
||||||
|
|
||||||
|
hbrush = SelectObject(hdc, hbrush);
|
||||||
|
hpen = SelectObject(hdc, GetStockObject(NULL_PEN));
|
||||||
|
|
||||||
if (lf.lfUnderline)
|
if (lf.lfUnderline)
|
||||||
|
{
|
||||||
|
pts[0].x = x - underlinePos * sinEsc;
|
||||||
|
pts[0].y = y - underlinePos * cosEsc;
|
||||||
|
pts[1].x = x + xwidth - underlinePos * sinEsc;
|
||||||
|
pts[1].y = y - ywidth - underlinePos * 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;
|
||||||
|
pts[3].y = pts[0].y + underlineWidth * cosEsc;
|
||||||
|
pts[4].x = pts[0].x;
|
||||||
|
pts[4].y = pts[0].y;
|
||||||
|
DPtoLP(hdc, pts, 5);
|
||||||
|
Polygon(hdc, pts, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lf.lfStrikeOut)
|
||||||
|
{
|
||||||
|
pts[0].x = x - strikeoutPos * sinEsc;
|
||||||
|
pts[0].y = y - strikeoutPos * cosEsc;
|
||||||
|
pts[1].x = x + xwidth - strikeoutPos * sinEsc;
|
||||||
|
pts[1].y = y - ywidth - strikeoutPos * 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;
|
||||||
|
pts[3].y = pts[0].y + strikeoutWidth * cosEsc;
|
||||||
|
pts[4].x = pts[0].x;
|
||||||
|
pts[4].y = pts[0].y;
|
||||||
|
DPtoLP(hdc, pts, 5);
|
||||||
|
Polygon(hdc, pts, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectObject(hdc, hpen);
|
||||||
|
hbrush = SelectObject(hdc, hbrush);
|
||||||
|
DeleteObject(hbrush);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
POINT pts[2], oldpt;
|
POINT pts[2], oldpt;
|
||||||
HPEN hpen = CreatePen(PS_SOLID, underlineWidth, GetTextColor(hdc));
|
HPEN hpen;
|
||||||
|
|
||||||
|
if (lf.lfUnderline)
|
||||||
|
{
|
||||||
|
hpen = CreatePen(PS_SOLID, underlineWidth, GetTextColor(hdc));
|
||||||
hpen = SelectObject(hdc, hpen);
|
hpen = SelectObject(hdc, hpen);
|
||||||
pts[0].x = x;
|
pts[0].x = x;
|
||||||
pts[0].y = y;
|
pts[0].y = y;
|
||||||
@ -2096,8 +2143,7 @@ done:
|
|||||||
|
|
||||||
if (lf.lfStrikeOut)
|
if (lf.lfStrikeOut)
|
||||||
{
|
{
|
||||||
POINT pts[2], oldpt;
|
hpen = CreatePen(PS_SOLID, strikeoutWidth, GetTextColor(hdc));
|
||||||
HPEN hpen = CreatePen(PS_SOLID, strikeoutWidth, GetTextColor(hdc));
|
|
||||||
hpen = SelectObject(hdc, hpen);
|
hpen = SelectObject(hdc, hpen);
|
||||||
pts[0].x = x;
|
pts[0].x = x;
|
||||||
pts[0].y = y;
|
pts[0].y = y;
|
||||||
@ -2110,6 +2156,7 @@ done:
|
|||||||
DeleteObject(SelectObject(hdc, hpen));
|
DeleteObject(SelectObject(hdc, hpen));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user