Commit 32f1ac3a authored by Alexandre Julliard's avatar Alexandre Julliard

Use the exported FONTENUMPROCW as parameter in the EnumDeviceFonts

driver function instead of defining a private function type.
parent e97fb4b0
......@@ -1507,8 +1507,7 @@ static void GetEnumStructs(Face *face, LPENUMLOGFONTEXW pelf,
* WineEngEnumFonts
*
*/
DWORD WineEngEnumFonts(LPLOGFONTW plf, DEVICEFONTENUMPROC proc,
LPARAM lparam)
DWORD WineEngEnumFonts(LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lparam)
{
Family *family;
Face *face;
......@@ -1561,7 +1560,7 @@ DWORD WineEngEnumFonts(LPLOGFONTW plf, DEVICEFONTENUMPROC proc,
csi.ciCharset, type, debugstr_w(elf.elfScript),
elf.elfLogFont.lfItalic, elf.elfLogFont.lfWeight,
ntm.ntmTm.ntmFlags);
ret = proc(&elf, &ntm, type, lparam);
ret = proc(&elf.elfLogFont, (TEXTMETRICW *)&ntm, type, lparam);
if(!ret) goto end;
}
}
......@@ -1593,7 +1592,7 @@ DWORD WineEngEnumFonts(LPLOGFONTW plf, DEVICEFONTENUMPROC proc,
csi.ciCharset, type, debugstr_w(elf.elfScript),
elf.elfLogFont.lfItalic, elf.elfLogFont.lfWeight,
ntm.ntmTm.ntmFlags);
ret = proc(&elf, &ntm, type, lparam);
ret = proc(&elf.elfLogFont, (TEXTMETRICW *)&ntm, type, lparam);
if(!ret) goto end;
}
}
......
......@@ -70,7 +70,7 @@ typedef struct tagDC_FUNCS
INT (*pEndDoc)(PHYSDEV);
INT (*pEndPage)(PHYSDEV);
BOOL (*pEndPath)(PHYSDEV);
BOOL (*pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM);
BOOL (*pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
INT (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
......@@ -217,7 +217,7 @@ extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk );
extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID);
extern GdiFont WineEngCreateFontInstance(DC*, HFONT);
extern BOOL WineEngDestroyFontInstance(HFONT handle);
extern DWORD WineEngEnumFonts(LPLOGFONTW, DEVICEFONTENUMPROC, LPARAM);
extern DWORD WineEngEnumFonts(LPLOGFONTW, FONTENUMPROCW, LPARAM);
extern BOOL WineEngGetCharWidth(GdiFont, UINT, UINT, LPINT);
extern DWORD WineEngGetFontData(GdiFont, DWORD, DWORD, LPVOID, DWORD);
extern DWORD WineEngGetGlyphIndices(GdiFont font, LPCWSTR lpstr, INT count,
......
......@@ -396,7 +396,7 @@ static UINT PSDRV_GetFontMetric(HDC hdc, const AFM *afm,
* PSDRV_EnumDeviceFonts
*/
BOOL PSDRV_EnumDeviceFonts( PSDRV_PDEVICE *physDev, LPLOGFONTW plf,
DEVICEFONTENUMPROC proc, LPARAM lp )
FONTENUMPROCW proc, LPARAM lp )
{
ENUMLOGFONTEXW lf;
NEWTEXTMETRICEXW tm;
......@@ -417,7 +417,7 @@ BOOL PSDRV_EnumDeviceFonts( PSDRV_PDEVICE *physDev, LPLOGFONTW plf,
if(family) {
for(afmle = family->afmlist; afmle; afmle = afmle->next) {
TRACE("Got '%s'\n", afmle->afm->FontName);
if( (b = (*proc)( &lf, &tm,
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm,
PSDRV_GetFontMetric( physDev->hdc, afmle->afm, &tm, &lf ),
lp )) )
bRet = b;
......@@ -430,7 +430,7 @@ BOOL PSDRV_EnumDeviceFonts( PSDRV_PDEVICE *physDev, LPLOGFONTW plf,
for(family = physDev->pi->Fonts; family; family = family->next) {
afmle = family->afmlist;
TRACE("Got '%s'\n", afmle->afm->FontName);
if( (b = (*proc)( &lf, &tm,
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm,
PSDRV_GetFontMetric( physDev->hdc, afmle->afm, &tm, &lf ),
lp )) )
bRet = b;
......
......@@ -121,7 +121,7 @@ extern BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT width, INT height, X11DRV_PDEVICE *physDevSrc,
INT xSrc, INT ySrc, DWORD rop );
extern BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
DEVICEFONTENUMPROC dfeproc, LPARAM lp );
FONTENUMPROCW dfeproc, LPARAM lp );
extern LONG X11DRV_GetBitmapBits( HBITMAP hbitmap, void *bits, LONG count );
extern BOOL X11DRV_GetCharWidth( X11DRV_PDEVICE *physDev, UINT firstChar,
UINT lastChar, LPINT buffer );
......
......@@ -3347,7 +3347,7 @@ HFONT X11DRV_SelectFont( X11DRV_PDEVICE *physDev, HFONT hfont )
* X11DRV_EnumDeviceFonts
*/
BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
DEVICEFONTENUMPROC proc, LPARAM lp )
FONTENUMPROCW proc, LPARAM lp )
{
ENUMLOGFONTEXW lf;
NEWTEXTMETRICEXW tm;
......@@ -3375,7 +3375,7 @@ BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
if(plf->lfCharSet == DEFAULT_CHARSET ||
plf->lfCharSet == pfi->df.dfCharSet) {
if( (b = (*proc)( &lf, &tm,
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm,
XFONT_GetFontMetric( pfi, &lf, &tm ), lp )) )
bRet = b;
else break;
......@@ -3388,7 +3388,7 @@ BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
{
if(pfr->fi)
{
if( (b = (*proc)( &lf, &tm,
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm,
XFONT_GetFontMetric( pfr->fi, &lf, &tm ), lp )) )
bRet = b;
else break;
......
......@@ -160,8 +160,6 @@ typedef struct tagDC
BOOL vport2WorldValid; /* Is xformVport2World valid? */
} DC;
typedef INT (*DEVICEFONTENUMPROC)(LPENUMLOGFONTEXW,NEWTEXTMETRICEXW *,DWORD,LPARAM);
/* extra stock object: default 1x1 bitmap for memory DCs */
#define DEFAULT_BITMAP (STOCK_LAST+1)
......
......@@ -569,22 +569,25 @@ static BOOL FONT_DeleteObject( HGDIOBJ handle, void *obj )
*
* Called by the device driver layer to pass font info
* down to the application.
*
* Note: plf is really an ENUMLOGFONTEXW, and ptm is a NEWTEXTMETRICEXW.
* We have to use other types because of the FONTENUMPROCW definition.
*/
static INT FONT_EnumInstance16( LPENUMLOGFONTEXW plf, NEWTEXTMETRICEXW *ptm,
DWORD fType, LPARAM lp )
static INT CALLBACK FONT_EnumInstance16( const LOGFONTW *plf, const TEXTMETRICW *ptm,
DWORD fType, LPARAM lp )
{
fontEnum16 *pfe = (fontEnum16*)lp;
INT ret = 1;
DC *dc;
if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
pfe->lpLogFontParam->lfCharSet == plf->lfCharSet )
{
WORD args[7];
DWORD result;
FONT_EnumLogFontExWTo16(plf, pfe->lpLogFont);
FONT_NewTextMetricExWTo16(ptm, pfe->lpTextMetric);
FONT_EnumLogFontExWTo16((const ENUMLOGFONTEXW *)plf, pfe->lpLogFont);
FONT_NewTextMetricExWTo16((const NEWTEXTMETRICEXW *)ptm, pfe->lpTextMetric);
pfe->dwFlags |= ENUM_CALLED;
GDI_ReleaseObj( pfe->hdc ); /* release the GDI lock */
......@@ -612,9 +615,12 @@ static INT FONT_EnumInstance16( LPENUMLOGFONTEXW plf, NEWTEXTMETRICEXW *ptm,
/***********************************************************************
* FONT_EnumInstance
*
* Note: plf is really an ENUMLOGFONTEXW, and ptm is a NEWTEXTMETRICEXW.
* We have to use other types because of the FONTENUMPROCW definition.
*/
static INT FONT_EnumInstance( LPENUMLOGFONTEXW plf, NEWTEXTMETRICEXW *ptm,
DWORD fType, LPARAM lp )
static INT CALLBACK FONT_EnumInstance( const LOGFONTW *plf, const TEXTMETRICW *ptm,
DWORD fType, LPARAM lp )
{
fontEnum32 *pfe = (fontEnum32*)lp;
INT ret = 1;
......@@ -622,7 +628,7 @@ static INT FONT_EnumInstance( LPENUMLOGFONTEXW plf, NEWTEXTMETRICEXW *ptm,
/* lfCharSet is at the same offset in both LOGFONTA and LOGFONTW */
if( pfe->lpLogFontParam->lfCharSet == DEFAULT_CHARSET ||
pfe->lpLogFontParam->lfCharSet == plf->elfLogFont.lfCharSet )
pfe->lpLogFontParam->lfCharSet == plf->lfCharSet )
{
/* convert font metrics */
ENUMLOGFONTEXA logfont;
......@@ -631,14 +637,14 @@ static INT FONT_EnumInstance( LPENUMLOGFONTEXW plf, NEWTEXTMETRICEXW *ptm,
pfe->dwFlags |= ENUM_CALLED;
if (!(pfe->dwFlags & ENUM_UNICODE))
{
FONT_EnumLogFontExWToA( plf, &logfont);
FONT_NewTextMetricExWToA( ptm, &tmA );
plf = (LPENUMLOGFONTEXW)&logfont;
ptm = (NEWTEXTMETRICEXW *)&tmA;
FONT_EnumLogFontExWToA( (const ENUMLOGFONTEXW *)plf, &logfont);
FONT_NewTextMetricExWToA( (const NEWTEXTMETRICEXW *)ptm, &tmA );
plf = (LOGFONTW *)&logfont.elfLogFont;
ptm = (TEXTMETRICW *)&tmA;
}
GDI_ReleaseObj( pfe->hdc ); /* release the GDI lock */
ret = pfe->lpEnumFunc( &plf->elfLogFont, (TEXTMETRICW *)ptm, fType, pfe->lpData );
ret = pfe->lpEnumFunc( plf, ptm, fType, pfe->lpData );
/* get the lock again and make sure the DC is still valid */
dc = DC_GetDCPtr( pfe->hdc );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment