Skip to content
Snippets Groups Projects
Commit 844625cb authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard
Browse files

Fixed some difficulties with the font on vertical tabs. Also plugged a

resource leak.
parent 361eebb1
No related branches found
No related tags found
No related merge requests found
......@@ -1406,7 +1406,7 @@ TAB_DrawItemInterior
RECT rcTemp;
RECT rcImage;
LOGFONTA logfont;
HFONT hFont;
HFONT hFont = 0;
HFONT hOldFont = 0; /* stop uninitialized warning */
INT nEscapement = 0; /* stop uninitialized warning */
......@@ -1483,8 +1483,12 @@ TAB_DrawItemInterior
{
if(lStyle & TCS_VERTICAL)
{
center_offset = ((drawRect->bottom - drawRect->top) - (rcText.right - rcText.left)) / 2;
center_offset = 0;
/*
currently the rcText rect is flawed because the rotated font does not
often match the horizontal font. So leave this as 0
((drawRect->bottom - drawRect->top) - (rcText.right - rcText.left)) / 2;
*/
if(lStyle & TCS_BOTTOM)
drawRect->top+=center_offset;
else
......@@ -1521,14 +1525,20 @@ TAB_DrawItemInterior
/* call CreateFontIndirectA, which requires us to set the values of the logfont we pass in */
if(lStyle & TCS_VERTICAL)
{
iPointSize = 9;
lstrcpyA(logfont.lfFaceName, "Arial");
logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
logfont.lfWeight = FW_NORMAL;
logfont.lfItalic = 0;
logfont.lfUnderline = 0;
logfont.lfStrikeOut = 0;
if (!GetObjectA((infoPtr->hFont) ?
infoPtr->hFont : GetStockObject(SYSTEM_FONT),
sizeof(LOGFONTA),&logfont))
{
iPointSize = 9;
lstrcpyA(logfont.lfFaceName, "Arial");
logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY),
72);
logfont.lfWeight = FW_NORMAL;
logfont.lfItalic = 0;
logfont.lfUnderline = 0;
logfont.lfStrikeOut = 0;
}
logfont.lfEscapement = nEscapement;
logfont.lfOrientation = nOrientation;
......@@ -1541,8 +1551,8 @@ TAB_DrawItemInterior
ExtTextOutW(hdc,
(lStyle & TCS_BOTTOM) ? drawRect->right : drawRect->left,
(!(lStyle & TCS_BOTTOM)) ? drawRect->bottom : drawRect->top,
0,
0,
ETO_CLIPPED,
drawRect,
infoPtr->items[iItem].pszText,
lstrlenW(infoPtr->items[iItem].pszText),
0);
......@@ -1563,7 +1573,11 @@ TAB_DrawItemInterior
*drawRect = rcTemp; /* restore drawRect */
if(lStyle & TCS_VERTICAL)
{
SelectObject(hdc, hOldFont); /* restore the original font */
if (hFont)
DeleteObject(hFont);
}
}
/*
......@@ -1834,8 +1848,11 @@ static void TAB_DrawItem(
}
/* This modifies r to be the text rectangle. */
{
HFONT hOldFont = SelectObject(hdc, infoPtr->hFont);
TAB_DrawItemInterior(hwnd, hdc, iItem, &r);
SelectObject(hdc,hOldFont);
}
/* Draw the focus rectangle */
if (((lStyle & TCS_FOCUSNEVER) == 0) &&
(GetFocus() == hwnd) &&
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment