* Copyright 2003 Andrew Greenwood
* Copyright 2003 Filip Navara
* Copyright 2009 Matthias Kupfer
+ * Copyright 2017 Katayama Hirofumi MZ
*
* Based on Wine code.
*
UINT opcode = flags & 0xf;
INT len = wp;
BOOL retval, tmp;
+ LOGFONTW lf;
+ HFONT hFontOriginal, hNaaFont = NULL;
if((opcode == DST_TEXT || opcode == DST_PREFIXTEXT) && !len) /* The string is '\0' terminated */
{
len = lstrlenA((LPSTR)lp);
}
+ hFontOriginal = GetCurrentObject(hdc, OBJ_FONT);
+ if (flags & (DSS_MONO | DSS_DISABLED))
+ {
+ /* Create a non-antialiased font */
+ GetObjectW(hFontOriginal, sizeof(lf), &lf);
+ lf.lfQuality = NONANTIALIASED_QUALITY;
+ hNaaFont = CreateFontIndirectW(&lf);
+ }
+
/* Find out what size the image has if not given by caller */
if(!cx || !cy)
{
if(!FillRect(memdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH))) goto cleanup;
SetBkColor(memdc, RGB(255, 255, 255));
SetTextColor(memdc, RGB(0, 0, 0));
- hfsave = (HFONT)SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
+ if (hNaaFont)
+ hfsave = (HFONT)SelectObject(memdc, hNaaFont);
+ else
+ hfsave = (HFONT)SelectObject(memdc, hFontOriginal);
SetLayout( memdc, GetLayout( hdc ));
/* DST_COMPLEX may draw text as well,
if(!hfsave && (opcode <= DST_PREFIXTEXT)) goto cleanup;
tmp = PAINTING_DrawStateJam(memdc, opcode, func, lp, len, &rc, dtflags, unicode);
if(hfsave) SelectObject(memdc, hfsave);
+ if (hNaaFont) DeleteObject(hNaaFont);
if(!tmp) goto cleanup;
/* This state cause the image to be dithered */