mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:06:04 +00:00
[USER32][WIN32K] Make antialiased disabled font readable. Patch by Katayama Hirofumi MZ. CORE-7721
svn path=/trunk/; revision=75928
This commit is contained in:
parent
8749cbd5b9
commit
763d7b8473
3 changed files with 28 additions and 8 deletions
|
@ -29,6 +29,7 @@ typedef struct _FONT_CACHE_ENTRY
|
|||
FT_Face Face;
|
||||
FT_BitmapGlyph BitmapGlyph;
|
||||
int Height;
|
||||
FT_Render_Mode RenderMode;
|
||||
MATRIX mxWorldToDevice;
|
||||
} FONT_CACHE_ENTRY, *PFONT_CACHE_ENTRY;
|
||||
|
||||
|
|
|
@ -1392,6 +1392,7 @@ IntGetFontRenderMode(LOGFONTW *logfont)
|
|||
switch (logfont->lfQuality)
|
||||
{
|
||||
case ANTIALIASED_QUALITY:
|
||||
break;
|
||||
case NONANTIALIASED_QUALITY:
|
||||
return FT_RENDER_MODE_MONO;
|
||||
case DRAFT_QUALITY:
|
||||
|
@ -2608,6 +2609,7 @@ ftGdiGlyphCacheGet(
|
|||
FT_Face Face,
|
||||
INT GlyphIndex,
|
||||
INT Height,
|
||||
FT_Render_Mode RenderMode,
|
||||
PMATRIX pmx)
|
||||
{
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
|
@ -2622,6 +2624,7 @@ ftGdiGlyphCacheGet(
|
|||
if ((FontEntry->Face == Face) &&
|
||||
(FontEntry->GlyphIndex == GlyphIndex) &&
|
||||
(FontEntry->Height == Height) &&
|
||||
(FontEntry->RenderMode == RenderMode) &&
|
||||
(SameScaleMatrix(&FontEntry->mxWorldToDevice, pmx)))
|
||||
break;
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
|
@ -2737,6 +2740,7 @@ ftGdiGlyphCacheSet(
|
|||
NewEntry->Face = Face;
|
||||
NewEntry->BitmapGlyph = BitmapGlyph;
|
||||
NewEntry->Height = Height;
|
||||
NewEntry->RenderMode = RenderMode;
|
||||
NewEntry->mxWorldToDevice = *pmx;
|
||||
|
||||
InsertHeadList(&FontCacheListHead, &NewEntry->ListEntry);
|
||||
|
@ -3589,7 +3593,6 @@ TextIntGetTextExtentPoint(PDC dc,
|
|||
else
|
||||
RenderMode = FT_RENDER_MODE_MONO;
|
||||
|
||||
|
||||
/* Get the DC's world-to-device transformation matrix */
|
||||
pmxWorldToDevice = DC_pmxWorldToDevice(dc);
|
||||
FtSetCoordinateTransform(face, pmxWorldToDevice);
|
||||
|
@ -3607,8 +3610,8 @@ TextIntGetTextExtentPoint(PDC dc,
|
|||
if (EmuBold || EmuItalic)
|
||||
realglyph = NULL;
|
||||
else
|
||||
realglyph = ftGdiGlyphCacheGet(face, glyph_index,
|
||||
plf->lfHeight, pmxWorldToDevice);
|
||||
realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
|
||||
RenderMode, pmxWorldToDevice);
|
||||
|
||||
if (EmuBold || EmuItalic || !realglyph)
|
||||
{
|
||||
|
@ -5320,8 +5323,8 @@ GreExtTextOutW(
|
|||
if (EmuBold || EmuItalic)
|
||||
realglyph = NULL;
|
||||
else
|
||||
realglyph = ftGdiGlyphCacheGet(face, glyph_index,
|
||||
plf->lfHeight, pmxWorldToDevice);
|
||||
realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
|
||||
RenderMode, pmxWorldToDevice);
|
||||
if (!realglyph)
|
||||
{
|
||||
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
|
||||
|
@ -5543,8 +5546,8 @@ GreExtTextOutW(
|
|||
if (EmuBold || EmuItalic)
|
||||
realglyph = NULL;
|
||||
else
|
||||
realglyph = ftGdiGlyphCacheGet(face, glyph_index,
|
||||
plf->lfHeight, pmxWorldToDevice);
|
||||
realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
|
||||
RenderMode, pmxWorldToDevice);
|
||||
if (!realglyph)
|
||||
{
|
||||
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* Copyright 2003 Andrew Greenwood
|
||||
* Copyright 2003 Filip Navara
|
||||
* Copyright 2009 Matthias Kupfer
|
||||
* Copyright 2017 Katayama Hirofumi MZ
|
||||
*
|
||||
* Based on Wine code.
|
||||
*
|
||||
|
@ -1242,6 +1243,8 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
|||
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 */
|
||||
{
|
||||
|
@ -1251,6 +1254,15 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
|||
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)
|
||||
{
|
||||
|
@ -1332,7 +1344,10 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
|||
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,
|
||||
|
@ -1341,6 +1356,7 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
|||
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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue