From 0bd611ceadf46c4e3fd5694443cc237faf92993c Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 21 Aug 2006 10:50:59 +0100 Subject: [PATCH] winex11.drv: Fix rendering of fonts that don't support anti-aliasing. --- dlls/winex11.drv/xrender.c | 62 ++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index de120292ba7..1f40b9bfb21 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -632,6 +632,36 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format) UINT ggo_format = GGO_GLYPH_INDEX; XRenderPictFormat pf; + switch(format) { + case AA_Grey: + ggo_format |= WINE_GGO_GRAY16_BITMAP; + break; + + default: + ERR("aa = %d - not implemented\n", format); + case AA_None: + ggo_format |= GGO_BITMAP; + break; + } + + buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL, + NULL); + if(buflen == GDI_ERROR) { + if(format != AA_None) { + format = AA_None; + entry->aa_default = AA_None; + ggo_format &= ~WINE_GGO_GRAY16_BITMAP; + ggo_format |= GGO_BITMAP; + buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL, + NULL); + } + if(buflen == GDI_ERROR) { + ERR("GetGlyphOutlineW failed\n"); + return FALSE; + } + TRACE("Turning off antialiasing for this monochrome font\n"); + } + /* If there is nothing for the current type, we create the entry. */ if( !entry->format[format] ) { entry->format[format] = HeapAlloc(GetProcessHeap(), @@ -676,35 +706,6 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph, AA_Type format) } } - switch(format) { - case AA_Grey: - ggo_format |= WINE_GGO_GRAY16_BITMAP; - break; - - default: - ERR("aa = %d - not implemented\n", format); - case AA_None: - ggo_format |= GGO_BITMAP; - break; - } - - buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL, - NULL); - if(buflen == GDI_ERROR) { - if(format != AA_None) { - format = AA_None; - entry->aa_default = AA_None; - ggo_format &= ~WINE_GGO_GRAY16_BITMAP; - ggo_format |= GGO_BITMAP; - buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL, - NULL); - } - if(buflen == GDI_ERROR) { - ERR("GetGlyphOutlineW failed\n"); - return FALSE; - } - TRACE("Turning off antialiasing for this monochrome font\n"); - } if(formatEntry->glyphset == 0 && X11DRV_XRender_Installed) { switch(format) { @@ -1250,6 +1251,9 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag for(idx = 0; idx < count; idx++) { if( !formatEntry ) { UploadGlyph(physDev, wstr[idx], antialias); + /* re-evaluate antialias since aa_default may have changed */ + if( disable_antialias == FALSE ) + antialias = entry->aa_default; formatEntry = entry->format[antialias]; } else if( wstr[idx] >= formatEntry->nrealized || formatEntry->realized[wstr[idx]] == FALSE) { UploadGlyph(physDev, wstr[idx], antialias);