Small 'let's prevent a crash' fix

Huw D M Davies h.davies1 at physics.ox.ac.uk
Tue Jul 2 17:17:57 CDT 2002


On Tue, Jul 02, 2002 at 11:25:47PM +0200, Lionel Ulmer wrote:
> > This does not fix the real problem (ie why does this DC not have a font even
> > if the application called a 'SelectObject' on it), but well, it cannot harm
> > to be more verbose and to prevent crashes if possible :-)
> 
> OK, found the 'error' : the problem comes from the fact that I am using
> client-side fonts (aka XRender) : so the 'font' part of the physDev
> structure is always '0'. And that also means that we cannot use as is the
> glXUseXFont function.
> 
> So basically, I need to implement it myself using 'GetGlyphOutline' (should
> not be that hard to do :-) ).
> 
> Now my question : is 'GetGlyphOutline' always working even when not using
> client-side fonts ? If yes, I will completely remove the call to
> glXUseXFonts (I know, in that case, fonts displayed by OpenGL will be
> different by the one displayed by X, but well, ...) and always use the
> manual 'GetGlyphOutline' function.

GetGylphOutline won't work if FreeType isn't available or if there are
no TrueType fonts installed.  At the moment the way to check for this
is to look at dc->gdiFont, if this is non-NULL then gdi font rendering
will work on this dc.  In x11drv we do this test as well as a test for
the RENDER extension at the top of X11DRV_SelectFont() and will fall
back to X11 fonts if either is not present.

Note though that if the dc is an x11drv dc for a non-RENDER enabled
server, then dc->gdiFont will be NULL, since X11DRV_SelectFont will
have returned TRUE which tells gdi to destroy any gdi font that it may
have created.

Huw.



More information about the wine-devel mailing list