http://bugs.winehq.com/show_bug.cgi?id=648
*** shadow/648 Mon May 6 03:45:13 2002 --- shadow/648.tmp.6993 Mon May 6 03:45:13 2002 *************** *** 0 **** --- 1,266 ---- + +============================================================================+ + | wineconsole regression on April 4 | + +----------------------------------------------------------------------------+ + | Bug #: 648 Product: Wine | + | Status: UNCONFIRMED Version: 20020411 | + | Resolution: Platform: | + | Severity: normal OS/Version: All | + | Priority: P1 Component: wine-console | + +----------------------------------------------------------------------------+ + | Assigned To: wine-bugs@winehq.com | + | Reported By: duncan.sands@wanadoo.fr | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | Milestone: TargetMilestone: --- | + | URL: | + +============================================================================+ + | DESCRIPTION | + Wineconsole regressed between 10pm April 3 and 10pm April 4 (GMT). + The IDA Pro disassembler (idaw.exe, available from + http://www.datarescue.be/downloadfreeware.htm) fails due to changes + on this date. This is a console mode program with turbo pascal style + windows, for example windows have a little green square as a close box. + + History: + + Jan 1 CVS : program runs with good sized font, however bitmaps like + the little green square show up as odd characters. + + Apr 3 CVS : program runs with tiny font, bitmaps are displayed correctly. + + > Apr 4 CVS : window comes up, disappears, wine exits without an error. + (Normal behaviour: window comes up, is resized, initial screen is drawn.) + + Thus the bug is: wine exits immediately after bringing up the window (but + before drawing anything in it). This seems to be due to changes in xfont.c. + + I offer here a choice of two patches that "fix" this. Surely neither + of them is getting to the root cause of the problem. Either works, + but with patch 2, the text comes up in a tiny font like with Apr 3 CVS, with + patch 1 it comes up in a normal font (but no little bitmaps, like Jan 1 CVS). + + All the best, + + Duncan. + + Patch 1. This reverts from using the global + variable text_caps to using a local variable XTextCaps. + + --- bad/graphics/x11drv/xfont.c.orig Wed May 1 09:42:32 2002 + +++ bad/graphics/x11drv/xfont.c Wed May 1 09:46:39 2002 + @@ -78,6 +78,11 @@ + + static fontAlias *aliasTable = NULL; + + +static UINT XTextCaps = (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE | TC_CR_ANY | + + TC_SA_DOUBLE | TC_SA_INTEGER | TC_SA_CONTIN | + + TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE); + + /* X11R6 adds TC_SF_X_YINDEP, maybe more... */ + + + static const char* INIFontMetrics = "cachedmetrics."; + static const char* INIFontSection = "Software\Wine\Wine\Config\fonts"; + static const char* INIAliasSection = "Alias"; + @@ -948,7 +953,7 @@ + aLFD.resolution_x = resx_string; + + strcpy(resy_string, resx_string); + - if( uRelax == 0 && text_caps & TC_SF_X_YINDEP ) + + if( uRelax == 0 && XTextCaps & TC_SF_X_YINDEP ) + { + if( fo->lf.lfWidth && !(fo->fo_flags & FO_SYNTH_WIDTH)) + { + @@ -2424,7 +2429,7 @@ + fontInfo* pfi = pfm->pfi; /* device font to match */ + LPLOGFONT16 plf = pfm->plf; /* wanted logical font */ + UINT penalty = 0; + - BOOL bR6 = pfm->flags & FO_MATCH_XYINDEP; /* from text_caps */ + + BOOL bR6 = pfm->flags & FO_MATCH_XYINDEP; /* from XTextCaps */ + BOOL bScale = pfi->fi_flags & FI_SCALABLE; + int d = 0, height; + + @@ -2947,7 +2952,7 @@ + strcpy(buffer, "-*-*-*-*-normal-*-[12 0 0 12]-*-72-*-*-*-iso8859-1"); + if( (x_fs = TSXLoadQueryFont(gdi_display, buffer)) ) + { + - text_caps |= TC_SF_X_YINDEP; + + XTextCaps |= TC_SF_X_YINDEP; + TSXFreeFont(gdi_display, x_fs); + } + } + @@ -2980,7 +2985,7 @@ + XFONT_GetPointResolution( log_pixels_x, log_pixels_y ); + + if(X11DRV_XRender_Installed) + - text_caps |= TC_VA_ABLE; + + XTextCaps |= TC_VA_ABLE; + + return; + } + @@ -3055,7 +3060,7 @@ + fm.plf = plf; + fm.internal_charset = internal_charset; + + - if( text_caps & TC_SF_X_YINDEP ) fm.flags = FO_MATCH_XYINDEP; + + if( XTextCaps & TC_SF_X_YINDEP ) fm.flags = FO_MATCH_XYINDEP; + + /* allocate new font cache entry */ + + ------------------------------------------------------------------- + + Patch 2. BOTH lines need to be changed. + + --- bad/graphics/x11drv/xfont.c.orig Wed May 1 09:42:32 2002 + +++ bad/graphics/x11drv/xfont.c Wed May 1 09:15:35 2002 + @@ -2978,6 +2978,7 @@ + void X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y ) + { + XFONT_GetPointResolution( log_pixels_x, log_pixels_y ); + + X11DRV_FONT_InitX11Metrics(); + + if(X11DRV_XRender_Installed) + text_caps |= TC_VA_ABLE; + @@ -3324,7 +3325,7 @@ + LOGFONT16 lf16; + + /* don't enumerate x11 fonts if we're using client side fonts */ + - if (physDev->dc->gdiFont) return FALSE; + +/* if (physDev->dc->gdiFont) return FALSE;*/ + + FONT_LogFontWTo16(plf, &lf16); + + ------------------------------------------------------------------------------- + + For information, here are the changes to xfont.c between + April 3 and April 4. + + diff -u -r --exclude=CVS 4_april_2002_mid/graphics/x11drv/xfont.c 4_april_2002/graphics/x11drv/xfont.c + --- 4_april_2002_mid/graphics/x11drv/xfont.c Mon Apr 29 20:56:51 2002 + +++ 4_april_2002/graphics/x11drv/xfont.c Sun Apr 28 20:53:50 2002 + @@ -77,11 +77,6 @@ + + static fontAlias *aliasTable = NULL; + + -static UINT XTextCaps = (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE | TC_CR_ANY | + - TC_SA_DOUBLE | TC_SA_INTEGER | TC_SA_CONTIN | + - TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE); + - /* X11R6 adds TC_SF_X_YINDEP, maybe more... */ + - + static const char* INIFontMetrics = "cachedmetrics."; + static const char* INIFontSection = "Software\Wine\Wine\Config\fonts"; + static const char* INIAliasSection = "Alias"; + @@ -952,7 +947,7 @@ + aLFD.resolution_x = resx_string; + + strcpy(resy_string, resx_string); + - if( uRelax == 0 && XTextCaps & TC_SF_X_YINDEP ) + + if( uRelax == 0 && text_caps & TC_SF_X_YINDEP ) + { + if( fo->lf.lfWidth && !(fo->fo_flags & FO_SYNTH_WIDTH)) + { + @@ -2428,7 +2423,7 @@ + fontInfo* pfi = pfm->pfi; /* device font to match */ + LPLOGFONT16 plf = pfm->plf; /* wanted logical font */ + UINT penalty = 0; + - BOOL bR6 = pfm->flags & FO_MATCH_XYINDEP; /* from TextCaps */ + + BOOL bR6 = pfm->flags & FO_MATCH_XYINDEP; /* from text_caps */ + BOOL bScale = pfi->fi_flags & FI_SCALABLE; + int d = 0, height; + + @@ -2834,24 +2829,22 @@ + } + + /*********************************************************************** + - * X11DRV_FONT_Init + + * X11DRV_FONT_InitX11Metrics + * + * Initialize font resource list and allocate font cache. + */ + -int X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y ) + +void X11DRV_FONT_InitX11Metrics( void ) + { + char** x_pattern; + unsigned x_checksum; + - int i,res, x_count, fd, buf_size; + + int i, x_count, fd, buf_size; + char *buffer; + HKEY hkey; + + - res = XFONT_GetPointResolution( log_pixels_x, log_pixels_y ); + - + + + x_pattern = TSXListFonts(gdi_display, "*", MAX_FONTS, &x_count ); + + - TRACE("Font Mapper: initializing %i fonts [logical dpi=%i, default dpi=%i]\n", + - x_count, res, DefResolution); + + TRACE("Font Mapper: initializing %i x11 fonts\n", x_count); + if (x_count == MAX_FONTS) + MESSAGE("There may be more fonts available - try increasing the value of MAX_FONTS\n"); + + @@ -2917,7 +2910,7 @@ + strcpy(buffer, "-*-*-*-*-normal-*-[12 0 0 12]-*-72-*-*-*-iso8859-1"); + if( (x_fs = TSXLoadQueryFont(gdi_display, buffer)) ) + { + - XTextCaps |= TC_SF_X_YINDEP; + + text_caps |= TC_SF_X_YINDEP; + TSXFreeFont(gdi_display, x_fs); + } + } + @@ -2939,11 +2932,20 @@ + + RAW_ASCENT = TSXInternAtom(gdi_display, "RAW_ASCENT", TRUE); + RAW_DESCENT = TSXInternAtom(gdi_display, "RAW_DESCENT", TRUE); + + return; + +} + + + +/*********************************************************************** + + * X11DRV_FONT_Init + + */ + +void X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y ) + +{ + + XFONT_GetPointResolution( log_pixels_x, log_pixels_y ); + + if(X11DRV_XRender_Installed) + - XTextCaps |= TC_VA_ABLE; + + text_caps |= TC_VA_ABLE; + + - return XTextCaps; + + return; + } + + /********************************************************************** + @@ -3016,7 +3018,7 @@ + fm.plf = plf; + fm.internal_charset = internal_charset; + + - if( XTextCaps & TC_SF_X_YINDEP ) fm.flags = FO_MATCH_XYINDEP; + + if( text_caps & TC_SF_X_YINDEP ) fm.flags = FO_MATCH_XYINDEP; + + /* allocate new font cache entry */ + + @@ -3203,6 +3205,8 @@ + + EnterCriticalSection( &crtsc_fonts_X11 ); + + + if(fontList == NULL) X11DRV_FONT_InitX11Metrics(); + + + if( CHECK_PFONT(physDev->font) ) + XFONT_ReleaseCacheEntry( __PFONT(physDev->font) ); + + @@ -3279,9 +3283,17 @@ + ENUMLOGFONTEXW lf; + NEWTEXTMETRICEXW tm; + fontResource* pfr = fontList; + - BOOL b, bRet = 0; + + BOOL b, bRet = 0, using_gdi = 0; + LOGFONT16 lf16; + + DC *dc; + + + + dc = DC_GetDCPtr(hdc); + + if(!dc) return FALSE; + + if(dc->gdiFont) using_gdi = TRUE; + + GDI_ReleaseObj(hdc); + + + /* don't enumerate x11 fonts if we're using client side fonts */ + + if(using_gdi) return FALSE; + + FONT_LogFontWTo16(plf, &lf16); \ No newline at end of file