PATCH: [Bug 19] - font enumeration problems for aliased gdi fonts
Rafael Kitover
caelum at debian.org
Tue Jul 23 15:00:59 CDT 2002
This patch fixes the "Invalid Property Value" message box that pops up
in older visual basic programs on startup when they try to call
ENUMFONTS on the default "MS Sans Serif" font for example.
(reference: http://www.winehq.com/hypermail/wine-bugs/2002/05/0116.html)
License: LGPL, X11
Changelog:
Rafael Kitover <caelum at debian.org>
Fix ENUMFONTS on aliased gdi fonts
--
plur
-------------- next part --------------
Name: Bug19_FontEnumAliasFix
ChangeLog: fixes bug #19, "invalid property" error from visual basic programs that try to call ENUMFONTS on fonts like MS Sans Serif, which now works if the font is aliased using properties like DefaultSansSerif
GenDate: 2002/07/23 19:42:51 UTC
ModifiedFiles: graphics/x11drv/xfont.c
AddedFiles:
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/xfont.c,v
retrieving revision 1.104
diff -u -r1.104 xfont.c
--- graphics/x11drv/xfont.c 20 Jun 2002 23:21:27 -0000 1.104
+++ graphics/x11drv/xfont.c 23 Jul 2002 19:43:18 -0000
@@ -3229,22 +3229,29 @@
LOGFONTW logfont;
LOGFONT16 lf;
DC *dc = physDev->dc;
+ HFONT retval = TRUE; /* Assuming that a device font will be used */
+
+ EnterCriticalSection( &crtsc_fonts_X11 );
TRACE("dc=%p, hfont=%04x\n", dc, hfont);
- if (!GetObjectW( hfont, sizeof(logfont), &logfont )) return GDI_ERROR;
+ if (!GetObjectW( hfont, sizeof(logfont), &logfont ))
+ {
+ retval = GDI_ERROR;
+ goto end;
+ }
+
+ /* Initialize font metrics now because gdi fonts can be aliases. */
+ if(fontList == NULL) X11DRV_FONT_InitX11Metrics();
TRACE("dc->gdiFont = %p\n", dc->gdiFont);
if(dc->gdiFont && X11DRV_XRender_Installed) {
X11DRV_XRender_SelectFont(physDev, hfont);
- return FALSE;
+ retval = FALSE;
+ goto end;
}
- EnterCriticalSection( &crtsc_fonts_X11 );
-
- if(fontList == NULL) X11DRV_FONT_InitX11Metrics();
-
if( CHECK_PFONT(physDev->font) )
XFONT_ReleaseCacheEntry( __PFONT(physDev->font) );
@@ -3305,9 +3312,10 @@
logfont.lfCharSet = charsetMatched;
}
+end:
LeaveCriticalSection( &crtsc_fonts_X11 );
- return TRUE; /* Use a device font */
+ return retval;
}
@@ -3323,16 +3331,34 @@
fontResource* pfr = fontList;
BOOL b, bRet = 0;
LOGFONT16 lf16;
-
- /* don't enumerate x11 fonts if we're using client side fonts */
- if (physDev->dc->gdiFont) return FALSE;
+ fontAlias* pfa;
+ char* faceName;
FONT_LogFontWTo16(plf, &lf16);
+ faceName = lf16.lfFaceName;
+
+ /* don't enumerate x11 fonts if we're using client side fonts, unless it's
+ * an alias for an x11 font. */
+ if (physDev->dc->gdiFont)
+ {
+ b = FALSE;
+
+ for (pfa = aliasTable; pfa; pfa = pfa->next)
+ {
+ if (strcmp(faceName, pfa->faAlias) == 0)
+ {
+ faceName = pfa->faTypeFace;
+ b = TRUE;
+ }
+ }
+
+ if (!b) return FALSE;
+ }
- if( lf16.lfFaceName[0] )
+ if( faceName[0] )
{
/* enum all entries in this resource */
- pfr = XFONT_FindFIList( pfr, lf16.lfFaceName );
+ pfr = XFONT_FindFIList( pfr, faceName );
if( pfr )
{
fontInfo* pfi;
More information about the wine-patches
mailing list