Help needed - CreateScalableFontResource

Shachar Shemesh wine-devel at sun.consumer.org.il
Wed Nov 27 11:08:08 CST 2002


Huw D M Davies wrote:

>On Tue, Nov 26, 2002 at 08:28:57PM +0200, Shachar Shemesh wrote:
>  
>
>>That did not work. Both CreateScalableFontResource and AddFontResource 
>>work. The application then goes on to enumerate the fonts, and 
>>X11Drv.EnumDeviceFonts fails to detect any "Amir" fonts. Output of +all 
>>of relevant part is at the end.
>>
>>Any idea why?
>>    
>>
>
>
>Yup, EnumFonts16 is broken.  Could you give this untested patch a go?
>
>Huw.
>  
>
Works great for me. Thanks!!

Is there any chance you'll submit the official fix to be included by the 
time we have to present the software (Monday - Sunday evening if you are 
in the US, as we are ahead of the US). I would like to be able to say 
that "this is the out of the box Wine".

                Shachar

>------------------------------------------------------------------------
>
>Index: objects/font.c
>===================================================================
>RCS file: /home/wine/wine/objects/font.c,v
>retrieving revision 1.93
>diff -u -r1.93 font.c
>--- objects/font.c	25 Nov 2002 21:09:49 -0000	1.93
>+++ objects/font.c	26 Nov 2002 20:11:51 -0000
>@@ -71,6 +71,7 @@
>   LPENUMLOGFONTEX16     lpLogFont;
>   SEGPTR                segTextMetric;
>   SEGPTR                segLogFont;
>+  DWORD                 dwFlags;
>   HDC                   hdc;
>   DC                   *dc;
>   PHYSDEV               physDev;
>@@ -524,6 +525,7 @@
>     {
>         FONT_EnumLogFontExWTo16(plf, pfe->lpLogFont);
> 	FONT_NewTextMetricExWTo16(ptm, pfe->lpTextMetric);
>+        pfe->dwFlags |= ENUM_CALLED;
>         GDI_ReleaseObj( pfe->hdc );  /* release the GDI lock */
> 
>         ret = FONT_CallTo16_word_llwl( pfe->lpEnumFunc, pfe->segLogFont, pfe->segTextMetric,
>@@ -590,36 +592,49 @@
>                                    DWORD dwFlags)
> {
>     fontEnum16 fe16;
>-    INT16	retVal = 0;
>+    INT16	ret = 1, ret2;
>     DC* 	dc = DC_GetDCPtr( HDC_32(hDC) );
>+    NEWTEXTMETRICEX16 tm16;
>+    ENUMLOGFONTEX16 lf16;
>+    LOGFONTW lfW;
>+    BOOL enum_gdi_fonts;
> 
>     if (!dc) return 0;
>+    FONT_LogFont16ToW(plf, &lfW);
>+
>     fe16.hdc = HDC_32(hDC);
>     fe16.dc = dc;
>     fe16.physDev = dc->physDev;
>+    fe16.lpLogFontParam = plf;
>+    fe16.lpEnumFunc = efproc;
>+    fe16.lpData = lParam;
>+    fe16.lpTextMetric = &tm16;
>+    fe16.lpLogFont = &lf16;
>+    fe16.segTextMetric = MapLS( &tm16 );
>+    fe16.segLogFont = MapLS( &lf16 );
>+    fe16.dwFlags = 0;
>+
>+    enum_gdi_fonts = GetDeviceCaps16(hDC, TEXTCAPS) & TC_VA_ABLE;
> 
>-    if (dc->funcs->pEnumDeviceFonts)
>+    if (!dc->funcs->pEnumDeviceFonts && !enum_gdi_fonts)
>     {
>-        NEWTEXTMETRICEX16 tm16;
>-        ENUMLOGFONTEX16 lf16;
>-        LOGFONTW lfW;
>-        FONT_LogFont16ToW(plf, &lfW);
>-
>-        fe16.lpLogFontParam = plf;
>-        fe16.lpEnumFunc = efproc;
>-        fe16.lpData = lParam;
>-        fe16.lpTextMetric = &tm16;
>-        fe16.lpLogFont = &lf16;
>-        fe16.segTextMetric = MapLS( &tm16 );
>-        fe16.segLogFont = MapLS( &lf16 );
>-
>-        retVal = dc->funcs->pEnumDeviceFonts( dc->physDev, &lfW,
>-                                              FONT_EnumInstance16, (LPARAM)&fe16 );
>-        UnMapLS( fe16.segTextMetric );
>-        UnMapLS( fe16.segLogFont );
>+        ret = 0;
>+        goto done;
>     }
>+
>+    if (enum_gdi_fonts)
>+        ret = WineEngEnumFonts( &lfW, FONT_EnumInstance16, (LPARAM)&fe16 );
>+    fe16.dwFlags &= ~ENUM_CALLED;
>+    if (ret && dc->funcs->pEnumDeviceFonts) {
>+	ret2 = dc->funcs->pEnumDeviceFonts( dc->physDev, &lfW, FONT_EnumInstance16, (LPARAM)&fe16 );
>+	if(fe16.dwFlags & ENUM_CALLED) /* update ret iff a font gets enumed */
>+	    ret = ret2;
>+    }
>+done:
>+    UnMapLS( fe16.segTextMetric );
>+    UnMapLS( fe16.segLogFont );
>     if (fe16.hdc) GDI_ReleaseObj( fe16.hdc );
>-    return retVal;
>+    return ret;
> }
> 
> /***********************************************************************
>  
>






More information about the wine-devel mailing list