Z przykrością muszę stwierdzić, że najwyraźniej funkcje rysujące ścieżki nie działają z wszystkimi typami czcionek, nie zauważyłem wcześniej tego ponieważ standardowo używam czcionki innej od tej, która jest automatycznie ustawiana. Poniższy kod z użyciem czcionki Times New Roman działa bez zarzutu.
PAINTSTRUCT ps;
HDC hdc;
TCHAR text[ ] = L"My text with outline.";
// settings
COLORREF myColor = RGB(150,200,50); //this should be a parameter from settings
int PenWidth = 2; //another parameter from settings
bool Outline = true; // one more - enabled/disabled
// the doing
hdc = BeginPaint(hWnd, &ps);
HFONT hFont = CreateFontW (100, 0,0,0,0,0,0,0,0,0,0,0,0, TEXT ("Times New Roman"));
SelectObject(hdc,hFont);
SetBkMode(hdc, TRANSPARENT);
TextOut(hdc,10,10,text,ARRAYSIZE(text)-1); // fill
if (Outline)
{
BeginPath(hdc);
TextOut(hdc,10,10,text,ARRAYSIZE(text)); // text into path
EndPath(hdc);
HPEN hP = CreatePen(PS_SOLID,PenWidth,myColor); // path to be drawn with selected pen
SelectObject(hdc,hP); // pen settings
StrokePath(hdc); // draw the path (outline around font)
DeleteObject(hP);
}
DeleteObject(hFont);
EndPaint(hWnd, &ps);