Pass a PHYSDEV to EnumDeviceFont and release the GDI lock in

FONT_EnumInstance instead.
This commit is contained in:
Alexandre Julliard 2002-04-14 19:42:43 +00:00
parent eac3662bc7
commit ab246a679b
10 changed files with 85 additions and 76 deletions

View File

@ -194,22 +194,16 @@ BOOL WIN16DRV_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar,
* WIN16DRV_EnumDeviceFonts * WIN16DRV_EnumDeviceFonts
*/ */
BOOL WIN16DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, BOOL WIN16DRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf,
DEVICEFONTENUMPROC proc, LPARAM lp ) DEVICEFONTENUMPROC proc, LPARAM lp )
{ {
WIN16DRV_PDEVICE *physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
WORD wRet; WORD wRet;
WEPFC wepfc; WEPFC wepfc;
DC *dc;
char *FaceNameA = NULL; char *FaceNameA = NULL;
/* EnumDFontCallback is GDI.158 */ /* EnumDFontCallback is GDI.158 */
FARPROC16 pfnCallback = GetProcAddress16( GetModuleHandle16("GDI"), (LPCSTR)158 ); FARPROC16 pfnCallback = GetProcAddress16( GetModuleHandle16("GDI"), (LPCSTR)158 );
if (!(dc = DC_GetDCPtr( hdc ))) return 0;
physDev = (WIN16DRV_PDEVICE *)dc->physDev;
/* FIXME!! */
GDI_ReleaseObj( hdc );
wepfc.proc = proc; wepfc.proc = proc;
wepfc.lp = lp; wepfc.lp = lp;

View File

@ -279,7 +279,8 @@ extern HPEN WIN16DRV_SelectPen( PHYSDEV dev, HPEN handle );
extern BOOL WIN16DRV_PatBlt( PHYSDEV dev, INT left, INT top, extern BOOL WIN16DRV_PatBlt( PHYSDEV dev, INT left, INT top,
INT width, INT height, DWORD rop ); INT width, INT height, DWORD rop );
extern BOOL WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom); extern BOOL WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom);
extern BOOL WIN16DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, DEVICEFONTENUMPROC proc, LPARAM lp ); extern BOOL WIN16DRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf,
DEVICEFONTENUMPROC proc, LPARAM lp );
extern INT WIN16DRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, extern INT WIN16DRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd,
LPDEVMODEA lpdmOutput, LPDEVMODEA lpdmOutput,

View File

@ -386,7 +386,7 @@ BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev )
/*********************************************************************** /***********************************************************************
* PSDRV_GetFontMetric * PSDRV_GetFontMetric
*/ */
static UINT PSDRV_GetFontMetric(HDC hdc, const AFM *afm, static UINT PSDRV_GetFontMetric( PSDRV_PDEVICE *physDev, const AFM *afm,
NEWTEXTMETRICEXW *ntmx, ENUMLOGFONTEXW *elfx) NEWTEXTMETRICEXW *ntmx, ENUMLOGFONTEXW *elfx)
{ {
/* ntmx->ntmTm is NEWTEXTMETRICW; compatible w/ TEXTMETRICW per Win32 doc */ /* ntmx->ntmTm is NEWTEXTMETRICW; compatible w/ TEXTMETRICW per Win32 doc */
@ -417,7 +417,7 @@ static UINT PSDRV_GetFontMetric(HDC hdc, const AFM *afm,
/*********************************************************************** /***********************************************************************
* PSDRV_EnumDeviceFonts * PSDRV_EnumDeviceFonts
*/ */
BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, BOOL PSDRV_EnumDeviceFonts( PSDRV_PDEVICE *physDev, LPLOGFONTW plf,
DEVICEFONTENUMPROC proc, LPARAM lp ) DEVICEFONTENUMPROC proc, LPARAM lp )
{ {
ENUMLOGFONTEXW lf; ENUMLOGFONTEXW lf;
@ -425,14 +425,7 @@ BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf,
BOOL b, bRet = 0; BOOL b, bRet = 0;
AFMLISTENTRY *afmle; AFMLISTENTRY *afmle;
FONTFAMILY *family; FONTFAMILY *family;
PSDRV_PDEVICE *physDev;
char FaceName[LF_FACESIZE]; char FaceName[LF_FACESIZE];
DC *dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE;
physDev = (PSDRV_PDEVICE *)dc->physDev;
/* FIXME!! should reevaluate dc->physDev after every callback */
GDI_ReleaseObj( hdc );
if( plf->lfFaceName[0] ) { if( plf->lfFaceName[0] ) {
WideCharToMultiByte(CP_ACP, 0, plf->lfFaceName, -1, WideCharToMultiByte(CP_ACP, 0, plf->lfFaceName, -1,
@ -446,9 +439,7 @@ BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf,
if(family) { if(family) {
for(afmle = family->afmlist; afmle; afmle = afmle->next) { for(afmle = family->afmlist; afmle; afmle = afmle->next) {
TRACE("Got '%s'\n", afmle->afm->FontName); TRACE("Got '%s'\n", afmle->afm->FontName);
if( (b = (*proc)( &lf, &tm, if( (b = proc( &lf, &tm, PSDRV_GetFontMetric(physDev, afmle->afm, &tm, &lf), lp )) )
PSDRV_GetFontMetric( hdc, afmle->afm, &tm, &lf ),
lp )) )
bRet = b; bRet = b;
else break; else break;
} }
@ -459,9 +450,7 @@ BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf,
for(family = physDev->pi->Fonts; family; family = family->next) { for(family = physDev->pi->Fonts; family; family = family->next) {
afmle = family->afmlist; afmle = family->afmlist;
TRACE("Got '%s'\n", afmle->afm->FontName); TRACE("Got '%s'\n", afmle->afm->FontName);
if( (b = (*proc)( &lf, &tm, if( (b = proc( &lf, &tm, PSDRV_GetFontMetric(physDev, afmle->afm, &tm, &lf), lp )) )
PSDRV_GetFontMetric( hdc, afmle->afm, &tm, &lf ),
lp )) )
bRet = b; bRet = b;
else break; else break;
} }

View File

@ -401,7 +401,7 @@ extern BOOL PSDRV_Ellipse( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom ); INT bottom );
extern INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev ); extern INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev );
extern INT PSDRV_EndPage( PSDRV_PDEVICE *physDev ); extern INT PSDRV_EndPage( PSDRV_PDEVICE *physDev );
extern BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, extern BOOL PSDRV_EnumDeviceFonts( PSDRV_PDEVICE *physDev, LPLOGFONTW plf,
DEVICEFONTENUMPROC proc, LPARAM lp ); DEVICEFONTENUMPROC proc, LPARAM lp );
extern BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags, extern BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR str, UINT count, const RECT *lprect, LPCWSTR str, UINT count,

View File

@ -22,7 +22,7 @@ debug_channels (psdrv)
@ cdecl Ellipse(ptr long long long long) PSDRV_Ellipse @ cdecl Ellipse(ptr long long long long) PSDRV_Ellipse
@ cdecl EndDoc(ptr) PSDRV_EndDoc @ cdecl EndDoc(ptr) PSDRV_EndDoc
@ cdecl EndPage(ptr) PSDRV_EndPage @ cdecl EndPage(ptr) PSDRV_EndPage
@ cdecl EnumDeviceFonts(long ptr ptr long) PSDRV_EnumDeviceFonts @ cdecl EnumDeviceFonts(ptr ptr ptr long) PSDRV_EnumDeviceFonts
@ cdecl ExtDeviceMode(ptr long ptr ptr ptr ptr ptr long) PSDRV_ExtDeviceMode @ cdecl ExtDeviceMode(ptr long ptr ptr ptr ptr ptr long) PSDRV_ExtDeviceMode
@ cdecl ExtEscape(ptr long long ptr long ptr) PSDRV_ExtEscape @ cdecl ExtEscape(ptr long long ptr long ptr) PSDRV_ExtEscape
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) PSDRV_ExtTextOut @ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) PSDRV_ExtTextOut

View File

@ -25,7 +25,7 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
@ cdecl DeleteObject(long) X11DRV_DeleteObject @ cdecl DeleteObject(long) X11DRV_DeleteObject
@ cdecl DescribePixelFormat(ptr long long ptr) X11DRV_DescribePixelFormat @ cdecl DescribePixelFormat(ptr long long ptr) X11DRV_DescribePixelFormat
@ cdecl Ellipse(ptr long long long long) X11DRV_Ellipse @ cdecl Ellipse(ptr long long long long) X11DRV_Ellipse
@ cdecl EnumDeviceFonts(long ptr ptr long) X11DRV_EnumDeviceFonts @ cdecl EnumDeviceFonts(ptr ptr ptr long) X11DRV_EnumDeviceFonts
@ cdecl ExtEscape(ptr long long ptr long ptr) X11DRV_ExtEscape @ cdecl ExtEscape(ptr long long ptr long ptr) X11DRV_ExtEscape
@ cdecl ExtFloodFill(ptr long long long long) X11DRV_ExtFloodFill @ cdecl ExtFloodFill(ptr long long long long) X11DRV_ExtFloodFill
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) X11DRV_ExtTextOut @ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) X11DRV_ExtTextOut

View File

@ -3313,23 +3313,17 @@ HFONT X11DRV_SelectFont( X11DRV_PDEVICE *physDev, HFONT hfont )
* *
* X11DRV_EnumDeviceFonts * X11DRV_EnumDeviceFonts
*/ */
BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
DEVICEFONTENUMPROC proc, LPARAM lp ) DEVICEFONTENUMPROC proc, LPARAM lp )
{ {
ENUMLOGFONTEXW lf; ENUMLOGFONTEXW lf;
NEWTEXTMETRICEXW tm; NEWTEXTMETRICEXW tm;
fontResource* pfr = fontList; fontResource* pfr = fontList;
BOOL b, bRet = 0, using_gdi = 0; BOOL b, bRet = 0;
LOGFONT16 lf16; 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 */ /* don't enumerate x11 fonts if we're using client side fonts */
if(using_gdi) return FALSE; if (physDev->dc->gdiFont) return FALSE;
FONT_LogFontWTo16(plf, &lf16); FONT_LogFontWTo16(plf, &lf16);

View File

@ -162,7 +162,7 @@ typedef struct tagDC_FUNCS
INT (*pEndDoc)(PHYSDEV); INT (*pEndDoc)(PHYSDEV);
INT (*pEndPage)(PHYSDEV); INT (*pEndPage)(PHYSDEV);
BOOL (*pEndPath)(PHYSDEV); BOOL (*pEndPath)(PHYSDEV);
BOOL (*pEnumDeviceFonts)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM); BOOL (*pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM);
INT (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT); INT (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD); INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID); INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);

View File

@ -108,7 +108,7 @@ extern unsigned int X11DRV_server_startticks;
extern BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, extern BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT width, INT height, X11DRV_PDEVICE *physDevSrc, INT width, INT height, X11DRV_PDEVICE *physDevSrc,
INT xSrc, INT ySrc, DWORD rop ); INT xSrc, INT ySrc, DWORD rop );
extern BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, extern BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
DEVICEFONTENUMPROC dfeproc, LPARAM lp ); DEVICEFONTENUMPROC dfeproc, LPARAM lp );
extern BOOL X11DRV_GetCharWidth( X11DRV_PDEVICE *physDev, UINT firstChar, extern BOOL X11DRV_GetCharWidth( X11DRV_PDEVICE *physDev, UINT firstChar,
UINT lastChar, LPINT buffer ); UINT lastChar, LPINT buffer );

View File

@ -46,6 +46,9 @@ typedef struct
LPENUMLOGFONTEX16 lpLogFont; LPENUMLOGFONTEX16 lpLogFont;
SEGPTR segTextMetric; SEGPTR segTextMetric;
SEGPTR segLogFont; SEGPTR segLogFont;
HDC hdc;
DC *dc;
PHYSDEV physDev;
} fontEnum16; } fontEnum16;
typedef struct typedef struct
@ -54,6 +57,9 @@ typedef struct
FONTENUMPROCEXW lpEnumFunc; FONTENUMPROCEXW lpEnumFunc;
LPARAM lpData; LPARAM lpData;
DWORD dwFlags; DWORD dwFlags;
HDC hdc;
DC *dc;
PHYSDEV physDev;
} fontEnum32; } fontEnum32;
/* /*
@ -642,18 +648,29 @@ INT FONT_GetObjectW( FONTOBJ *font, INT count, LPSTR buffer )
static INT FONT_EnumInstance16( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm, static INT FONT_EnumInstance16( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm,
DWORD fType, LPARAM lp ) DWORD fType, LPARAM lp )
{ {
#define pfe ((fontEnum16*)lp) fontEnum16 *pfe = (fontEnum16*)lp;
INT ret = 1;
DC *dc;
if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET || if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet ) pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
{ {
FONT_EnumLogFontExWTo16(plf, pfe->lpLogFont); FONT_EnumLogFontExWTo16(plf, pfe->lpLogFont);
FONT_NewTextMetricExWTo16(ptm, pfe->lpTextMetric); FONT_NewTextMetricExWTo16(ptm, pfe->lpTextMetric);
GDI_ReleaseObj( pfe->hdc ); /* release the GDI lock */
return FONT_CallTo16_word_llwl( pfe->lpEnumFunc, pfe->segLogFont, pfe->segTextMetric, ret = FONT_CallTo16_word_llwl( pfe->lpEnumFunc, pfe->segLogFont, pfe->segTextMetric,
(UINT16)fType, (LPARAM)pfe->lpData ); (UINT16)fType, (LPARAM)pfe->lpData );
/* get the lock again and make sure the DC is still valid */
dc = DC_GetDCPtr( pfe->hdc );
if (!dc || dc != pfe->dc || dc->physDev != pfe->physDev)
{
if (dc) GDI_ReleaseObj( pfe->hdc );
pfe->hdc = 0; /* make sure we don't try to release it later on */
ret = 0;
} }
#undef pfe }
return 1; return ret;
} }
/*********************************************************************** /***********************************************************************
@ -662,34 +679,40 @@ static INT FONT_EnumInstance16( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm,
static INT FONT_EnumInstance( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm, static INT FONT_EnumInstance( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm,
DWORD fType, LPARAM lp ) DWORD fType, LPARAM lp )
{ {
/* lfCharSet is at the same offset in both LOGFONTA and LOGFONTW */ fontEnum32 *pfe = (fontEnum32*)lp;
INT ret = 1;
DC *dc;
#define pfe ((fontEnum32*)lp) /* lfCharSet is at the same offset in both LOGFONTA and LOGFONTW */
if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET || if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet ) pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
{ {
/* convert font metrics */ /* convert font metrics */
pfe->dwFlags |= ENUM_CALLED;
if( pfe->dwFlags & ENUM_UNICODE )
{
return pfe->lpEnumFunc( plf, ptm, fType, pfe->lpData );
}
else
{
ENUMLOGFONTEXA logfont; ENUMLOGFONTEXA logfont;
NEWTEXTMETRICEXA tmA; NEWTEXTMETRICEXA tmA;
pfe->dwFlags |= ENUM_CALLED;
if (!(pfe->dwFlags & ENUM_UNICODE))
{
FONT_EnumLogFontExWToA( plf, &logfont); FONT_EnumLogFontExWToA( plf, &logfont);
FONT_NewTextMetricExWToA( ptm, &tmA ); FONT_NewTextMetricExWToA( ptm, &tmA );
plf = (LPENUMLOGFONTEXW)&logfont;
ptm = (LPNEWTEXTMETRICEXW)&tmA;
}
GDI_ReleaseObj( pfe->hdc ); /* release the GDI lock */
return pfe->lpEnumFunc( (LPENUMLOGFONTEXW)&logfont, ret = pfe->lpEnumFunc( plf, ptm, fType, pfe->lpData );
(LPNEWTEXTMETRICEXW)&tmA, fType,
pfe->lpData ); /* get the lock again and make sure the DC is still valid */
dc = DC_GetDCPtr( pfe->hdc );
if (!dc || dc != pfe->dc || dc->physDev != pfe->physDev)
{
if (dc) GDI_ReleaseObj( pfe->hdc );
pfe->hdc = 0; /* make sure we don't try to release it later on */
ret = 0;
} }
} }
#undef pfe return ret;
return 1;
} }
/*********************************************************************** /***********************************************************************
@ -699,19 +722,19 @@ INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf,
FONTENUMPROCEX16 efproc, LPARAM lParam, FONTENUMPROCEX16 efproc, LPARAM lParam,
DWORD dwFlags) DWORD dwFlags)
{ {
BOOL (*enum_func)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM); fontEnum16 fe16;
INT16 retVal = 0; INT16 retVal = 0;
DC* dc = DC_GetDCPtr( hDC ); DC* dc = DC_GetDCPtr( hDC );
if (!dc) return 0; if (!dc) return 0;
enum_func = dc->funcs->pEnumDeviceFonts; fe16.hdc = hDC;
GDI_ReleaseObj( hDC ); fe16.dc = dc;
fe16.physDev = dc->physDev;
if (enum_func) if (dc->funcs->pEnumDeviceFonts)
{ {
NEWTEXTMETRICEX16 tm16; NEWTEXTMETRICEX16 tm16;
ENUMLOGFONTEX16 lf16; ENUMLOGFONTEX16 lf16;
fontEnum16 fe16;
LOGFONTW lfW; LOGFONTW lfW;
FONT_LogFont16ToW(plf, &lfW); FONT_LogFont16ToW(plf, &lfW);
@ -723,10 +746,12 @@ INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf,
fe16.segTextMetric = MapLS( &tm16 ); fe16.segTextMetric = MapLS( &tm16 );
fe16.segLogFont = MapLS( &lf16 ); fe16.segLogFont = MapLS( &lf16 );
retVal = enum_func( hDC, &lfW, FONT_EnumInstance16, (LPARAM)&fe16 ); retVal = dc->funcs->pEnumDeviceFonts( dc->physDev, &lfW,
FONT_EnumInstance16, (LPARAM)&fe16 );
UnMapLS( fe16.segTextMetric ); UnMapLS( fe16.segTextMetric );
UnMapLS( fe16.segLogFont ); UnMapLS( fe16.segLogFont );
} }
if (fe16.hdc) GDI_ReleaseObj( fe16.hdc );
return retVal; return retVal;
} }
@ -737,7 +762,6 @@ static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf,
FONTENUMPROCEXW efproc, FONTENUMPROCEXW efproc,
LPARAM lParam, DWORD dwUnicode) LPARAM lParam, DWORD dwUnicode)
{ {
BOOL (*enum_func)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM);
INT ret = 1, ret2; INT ret = 1, ret2;
DC *dc = DC_GetDCPtr( hDC ); DC *dc = DC_GetDCPtr( hDC );
fontEnum32 fe32; fontEnum32 fe32;
@ -751,21 +775,28 @@ static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf,
fe32.lpEnumFunc = efproc; fe32.lpEnumFunc = efproc;
fe32.lpData = lParam; fe32.lpData = lParam;
fe32.dwFlags = dwUnicode; fe32.dwFlags = dwUnicode;
fe32.hdc = hDC;
fe32.dc = dc;
fe32.physDev = dc->physDev;
enum_func = dc->funcs->pEnumDeviceFonts;
GDI_ReleaseObj( hDC );
enum_gdi_fonts = GetDeviceCaps(hDC, TEXTCAPS) & TC_VA_ABLE; enum_gdi_fonts = GetDeviceCaps(hDC, TEXTCAPS) & TC_VA_ABLE;
if (!enum_func && !enum_gdi_fonts) return 0; if (!dc->funcs->pEnumDeviceFonts && !enum_gdi_fonts)
{
ret = 0;
goto done;
}
if (enum_gdi_fonts) if (enum_gdi_fonts)
ret = WineEngEnumFonts( plf, FONT_EnumInstance, (LPARAM)&fe32 ); ret = WineEngEnumFonts( plf, FONT_EnumInstance, (LPARAM)&fe32 );
fe32.dwFlags &= ~ENUM_CALLED; fe32.dwFlags &= ~ENUM_CALLED;
if (ret && enum_func) { if (ret && dc->funcs->pEnumDeviceFonts) {
ret2 = enum_func( hDC, plf, FONT_EnumInstance, (LPARAM)&fe32 ); ret2 = dc->funcs->pEnumDeviceFonts( dc->physDev, plf, FONT_EnumInstance, (LPARAM)&fe32 );
if(fe32.dwFlags & ENUM_CALLED) /* update ret iff a font gets enumed */ if(fe32.dwFlags & ENUM_CALLED) /* update ret iff a font gets enumed */
ret = ret2; ret = ret2;
} }
done:
if (fe32.hdc) GDI_ReleaseObj( fe32.hdc );
return ret; return ret;
} }