Index: reactos/win32ss/gdi/ntgdi/freetype.c =================================================================== --- reactos/win32ss/gdi/ntgdi/freetype.c (revision 75391) +++ reactos/win32ss/gdi/ntgdi/freetype.c (working copy) @@ -1392,6 +1392,7 @@ switch (logfont->lfQuality) { case ANTIALIASED_QUALITY: + break; case NONANTIALIASED_QUALITY: return FT_RENDER_MODE_MONO; case DRAFT_QUALITY: @@ -3558,7 +3559,6 @@ else RenderMode = FT_RENDER_MODE_MONO; - /* Get the DC's world-to-device transformation matrix */ pmxWorldToDevice = DC_pmxWorldToDevice(dc); FtSetCoordinateTransform(face, pmxWorldToDevice); @@ -5071,6 +5071,7 @@ LOGFONTW *plf; BOOL EmuBold, EmuItalic; int thickness; + FT_Int32 load_flags; // TODO: Write test-cases to exactly match real Windows in different // bad parameters (e.g. does Windows check the DC or the RECT first?). @@ -5213,6 +5214,11 @@ else RenderMode = FT_RENDER_MODE_MONO; + if (RenderMode == FT_RENDER_MODE_MONO) + load_flags = FT_LOAD_MONOCHROME; + else + load_flags = FT_LOAD_DEFAULT; + if (!TextIntUpdateSize(dc, TextObj, FontGDI, FALSE)) { IntUnLockFreeType; @@ -5282,7 +5288,7 @@ else glyph_index = FT_Get_Char_Index(face, *TempText); - if (EmuBold || EmuItalic) + if (EmuBold || EmuItalic || RenderMode == FT_RENDER_MODE_MONO) realglyph = NULL; else realglyph = ftGdiGlyphCacheGet(face, glyph_index, @@ -5289,7 +5295,7 @@ plf->lfHeight, pmxWorldToDevice); if (!realglyph) { - error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); + error = FT_Load_Glyph(face, glyph_index, load_flags); if (error) { DPRINT1("WARNING: Failed to load and render glyph! [index: %d]\n", glyph_index); @@ -5296,7 +5302,7 @@ } glyph = face->glyph; - if (EmuBold || EmuItalic) + if (EmuBold || EmuItalic || RenderMode == FT_RENDER_MODE_MONO) { if (EmuBold) FT_GlyphSlot_Embolden(glyph); @@ -5331,7 +5337,7 @@ TextWidth += realglyph->root.advance.x >> 10; - if (EmuBold || EmuItalic) + if (EmuBold || EmuItalic || RenderMode == FT_RENDER_MODE_MONO) { FT_Done_Glyph((FT_Glyph)realglyph); realglyph = NULL; @@ -5393,7 +5399,7 @@ else glyph_index = FT_Get_Char_Index(face, String[i]); - error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); + error = FT_Load_Glyph(face, glyph_index, load_flags); if (error) { DPRINT1("Failed to load and render glyph! [index: %d]\n", glyph_index); @@ -5507,7 +5513,7 @@ else glyph_index = FT_Get_Char_Index(face, String[i]); - if (EmuBold || EmuItalic) + if (EmuBold || EmuItalic || RenderMode == FT_RENDER_MODE_MONO) realglyph = NULL; else realglyph = ftGdiGlyphCacheGet(face, glyph_index, @@ -5514,7 +5520,7 @@ plf->lfHeight, pmxWorldToDevice); if (!realglyph) { - error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT); + error = FT_Load_Glyph(face, glyph_index, load_flags); if (error) { DPRINT1("Failed to load and render glyph! [index: %d]\n", glyph_index); @@ -5524,7 +5530,7 @@ } glyph = face->glyph; - if (EmuBold || EmuItalic) + if (EmuBold || EmuItalic || RenderMode == FT_RENDER_MODE_MONO) { if (EmuBold) FT_GlyphSlot_Embolden(glyph); @@ -5738,7 +5744,7 @@ previous = glyph_index; - if (EmuBold || EmuItalic) + if (EmuBold || EmuItalic || RenderMode == FT_RENDER_MODE_MONO) { FT_Done_Glyph((FT_Glyph)realglyph); realglyph = NULL; Index: reactos/win32ss/user/user32/controls/button.c =================================================================== --- reactos/win32ss/user/user32/controls/button.c (revision 75391) +++ reactos/win32ss/user/user32/controls/button.c (working copy) @@ -880,11 +880,10 @@ * must use DSS_MONO flag and COLOR_GRAYTEXT brush (or maybe DSS_UNION). * I don't have Win31 on hand to verify that, so I leave it as is. */ - if ((style & BS_PUSHLIKE) && (state & BST_INDETERMINATE)) { hbr = GetSysColorBrush(COLOR_GRAYTEXT); - flags |= DSS_MONO; + flags |= DSS_DISABLED; } switch (style & (BS_ICON|BS_BITMAP)) Index: reactos/win32ss/user/user32/windows/draw.c =================================================================== --- reactos/win32ss/user/user32/windows/draw.c (revision 75391) +++ reactos/win32ss/user/user32/windows/draw.c (working copy) @@ -1242,13 +1242,27 @@ UINT opcode = flags & 0xf; INT len = wp; BOOL retval, tmp; + HFONT hFontOriginal, hFontOld = NULL; + LOGFONT lf; - if((opcode == DST_TEXT || opcode == DST_PREFIXTEXT) && !len) /* The string is '\0' terminated */ + if (opcode == DST_TEXT || opcode == DST_PREFIXTEXT) /* The string is '\0' terminated */ { - if(unicode) - len = lstrlenW((LPWSTR)lp); - else - len = lstrlenA((LPSTR)lp); + if (!len) + { + if (unicode) + len = lstrlenW((LPWSTR)lp); + else + len = lstrlenA((LPSTR)lp); + } + + if (flags & (DSS_MONO | DSS_DISABLED)) + { + /* Create a non-antialiased font */ + hFontOriginal = GetCurrentObject(hdc, OBJ_FONT); + GetObjectW(hFontOriginal, sizeof(lf), &lf); + lf.lfQuality = NONANTIALIASED_QUALITY; + hFontOld = SelectObject(hdc, CreateFontIndirectW(&lf)); + } } /* Find out what size the image has if not given by caller */ @@ -1393,6 +1407,11 @@ if(hbm) DeleteObject(hbm); if(memdc) DeleteDC(memdc); + if (hFontOld) + { + DeleteObject(SelectObject(hdc, hFontOld)); + } + return retval; }