gdi32: Implement EnumDeviceFonts as a standard driver entry point.
This commit is contained in:
parent
873bf81d3b
commit
cbd81d391c
|
@ -276,7 +276,7 @@ static INT nulldrv_EndPage( PHYSDEV dev )
|
||||||
|
|
||||||
static BOOL nulldrv_EnumDeviceFonts( PHYSDEV dev, LOGFONTW *logfont, FONTENUMPROCW proc, LPARAM lParam )
|
static BOOL nulldrv_EnumDeviceFonts( PHYSDEV dev, LOGFONTW *logfont, FONTENUMPROCW proc, LPARAM lParam )
|
||||||
{
|
{
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT nulldrv_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW func, LPARAM lparam )
|
static INT nulldrv_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW func, LPARAM lparam )
|
||||||
|
|
|
@ -100,23 +100,20 @@ static const struct gdi_obj_funcs font_funcs =
|
||||||
FONT_DeleteObject /* pDeleteObject */
|
FONT_DeleteObject /* pDeleteObject */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ENUM_UNICODE 0x00000001
|
|
||||||
#define ENUM_CALLED 0x00000002
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GDIOBJHDR header;
|
GDIOBJHDR header;
|
||||||
LOGFONTW logfont;
|
LOGFONTW logfont;
|
||||||
} FONTOBJ;
|
} FONTOBJ;
|
||||||
|
|
||||||
typedef struct
|
struct font_enum
|
||||||
{
|
{
|
||||||
LPLOGFONTW lpLogFontParam;
|
LPLOGFONTW lpLogFontParam;
|
||||||
FONTENUMPROCW lpEnumFunc;
|
FONTENUMPROCW lpEnumFunc;
|
||||||
LPARAM lpData;
|
LPARAM lpData;
|
||||||
DWORD dwFlags;
|
BOOL unicode;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
} fontEnum32;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For TranslateCharsetInfo
|
* For TranslateCharsetInfo
|
||||||
|
@ -613,7 +610,7 @@ static BOOL FONT_DeleteObject( HGDIOBJ handle )
|
||||||
static INT CALLBACK FONT_EnumInstance( const LOGFONTW *plf, const TEXTMETRICW *ptm,
|
static INT CALLBACK FONT_EnumInstance( const LOGFONTW *plf, const TEXTMETRICW *ptm,
|
||||||
DWORD fType, LPARAM lp )
|
DWORD fType, LPARAM lp )
|
||||||
{
|
{
|
||||||
fontEnum32 *pfe = (fontEnum32*)lp;
|
struct font_enum *pfe = (struct font_enum *)lp;
|
||||||
INT ret = 1;
|
INT ret = 1;
|
||||||
|
|
||||||
/* lfCharSet is at the same offset in both LOGFONTA and LOGFONTW */
|
/* lfCharSet is at the same offset in both LOGFONTA and LOGFONTW */
|
||||||
|
@ -626,15 +623,13 @@ static INT CALLBACK FONT_EnumInstance( const LOGFONTW *plf, const TEXTMETRICW *p
|
||||||
ENUMLOGFONTEXA logfont;
|
ENUMLOGFONTEXA logfont;
|
||||||
NEWTEXTMETRICEXA tmA;
|
NEWTEXTMETRICEXA tmA;
|
||||||
|
|
||||||
pfe->dwFlags |= ENUM_CALLED;
|
if (!pfe->unicode)
|
||||||
if (!(pfe->dwFlags & ENUM_UNICODE))
|
|
||||||
{
|
{
|
||||||
FONT_EnumLogFontExWToA( (const ENUMLOGFONTEXW *)plf, &logfont);
|
FONT_EnumLogFontExWToA( (const ENUMLOGFONTEXW *)plf, &logfont);
|
||||||
FONT_NewTextMetricExWToA( (const NEWTEXTMETRICEXW *)ptm, &tmA );
|
FONT_NewTextMetricExWToA( (const NEWTEXTMETRICEXW *)ptm, &tmA );
|
||||||
plf = (LOGFONTW *)&logfont.elfLogFont;
|
plf = (LOGFONTW *)&logfont.elfLogFont;
|
||||||
ptm = (TEXTMETRICW *)&tmA;
|
ptm = (TEXTMETRICW *)&tmA;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = pfe->lpEnumFunc( plf, ptm, fType, pfe->lpData );
|
ret = pfe->lpEnumFunc( plf, ptm, fType, pfe->lpData );
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -643,37 +638,24 @@ static INT CALLBACK FONT_EnumInstance( const LOGFONTW *plf, const TEXTMETRICW *p
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* FONT_EnumFontFamiliesEx
|
* FONT_EnumFontFamiliesEx
|
||||||
*/
|
*/
|
||||||
static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf,
|
static INT FONT_EnumFontFamiliesEx( HDC hDC, LPLOGFONTW plf, FONTENUMPROCW efproc,
|
||||||
FONTENUMPROCW efproc,
|
LPARAM lParam, BOOL unicode )
|
||||||
LPARAM lParam, DWORD dwUnicode)
|
|
||||||
{
|
{
|
||||||
INT ret = 1, ret2;
|
INT ret = 0;
|
||||||
DC *dc = get_dc_ptr( hDC );
|
DC *dc = get_dc_ptr( hDC );
|
||||||
fontEnum32 fe32;
|
struct font_enum fe;
|
||||||
BOOL enum_gdi_fonts;
|
|
||||||
|
|
||||||
if (!dc) return 0;
|
if (dc)
|
||||||
|
|
||||||
if (plf)
|
|
||||||
TRACE("lfFaceName = %s lfCharset = %d\n", debugstr_w(plf->lfFaceName),
|
|
||||||
plf->lfCharSet);
|
|
||||||
fe32.lpLogFontParam = plf;
|
|
||||||
fe32.lpEnumFunc = efproc;
|
|
||||||
fe32.lpData = lParam;
|
|
||||||
fe32.dwFlags = dwUnicode;
|
|
||||||
fe32.hdc = hDC;
|
|
||||||
|
|
||||||
enum_gdi_fonts = GetDeviceCaps(hDC, TEXTCAPS) & TC_VA_ABLE;
|
|
||||||
|
|
||||||
if (enum_gdi_fonts)
|
|
||||||
ret = WineEngEnumFonts( plf, FONT_EnumInstance, (LPARAM)&fe32 );
|
|
||||||
fe32.dwFlags &= ~ENUM_CALLED;
|
|
||||||
if (ret)
|
|
||||||
{
|
{
|
||||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pEnumDeviceFonts );
|
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pEnumDeviceFonts );
|
||||||
ret2 = physdev->funcs->pEnumDeviceFonts( physdev, plf, FONT_EnumInstance, (LPARAM)&fe32 );
|
|
||||||
if(fe32.dwFlags & ENUM_CALLED) /* update ret iff a font gets enumed */
|
if (plf) TRACE("lfFaceName = %s lfCharset = %d\n", debugstr_w(plf->lfFaceName), plf->lfCharSet);
|
||||||
ret = ret2;
|
fe.lpLogFontParam = plf;
|
||||||
|
fe.lpEnumFunc = efproc;
|
||||||
|
fe.lpData = lParam;
|
||||||
|
fe.unicode = unicode;
|
||||||
|
fe.hdc = hDC;
|
||||||
|
ret = physdev->funcs->pEnumDeviceFonts( physdev, plf, FONT_EnumInstance, (LPARAM)&fe );
|
||||||
}
|
}
|
||||||
release_dc_ptr( dc );
|
release_dc_ptr( dc );
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -686,7 +668,7 @@ INT WINAPI EnumFontFamiliesExW( HDC hDC, LPLOGFONTW plf,
|
||||||
FONTENUMPROCW efproc,
|
FONTENUMPROCW efproc,
|
||||||
LPARAM lParam, DWORD dwFlags )
|
LPARAM lParam, DWORD dwFlags )
|
||||||
{
|
{
|
||||||
return FONT_EnumFontFamiliesEx( hDC, plf, efproc, lParam, ENUM_UNICODE );
|
return FONT_EnumFontFamiliesEx( hDC, plf, efproc, lParam, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -705,7 +687,7 @@ INT WINAPI EnumFontFamiliesExA( HDC hDC, LPLOGFONTA plf,
|
||||||
}
|
}
|
||||||
else plfW = NULL;
|
else plfW = NULL;
|
||||||
|
|
||||||
return FONT_EnumFontFamiliesEx( hDC, plfW, (FONTENUMPROCW)efproc, lParam, 0);
|
return FONT_EnumFontFamiliesEx( hDC, plfW, (FONTENUMPROCW)efproc, lParam, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
|
@ -4584,10 +4584,9 @@ static BOOL enum_face_charsets(Face *face, struct enum_charset_list *list,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* WineEngEnumFonts
|
* freetype_EnumDeviceFonts
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
DWORD WineEngEnumFonts(LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lparam)
|
static BOOL freetype_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lparam )
|
||||||
{
|
{
|
||||||
Family *family;
|
Family *family;
|
||||||
Face *face;
|
Face *face;
|
||||||
|
@ -4627,7 +4626,7 @@ DWORD WineEngEnumFonts(LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lparam)
|
||||||
LIST_FOR_EACH(face_elem_ptr, &family->faces) {
|
LIST_FOR_EACH(face_elem_ptr, &family->faces) {
|
||||||
face = LIST_ENTRY(face_elem_ptr, Face, entry);
|
face = LIST_ENTRY(face_elem_ptr, Face, entry);
|
||||||
if (!face_matches(face, plf)) continue;
|
if (!face_matches(face, plf)) continue;
|
||||||
if (!enum_face_charsets(face, &enum_charsets, proc, lparam)) return 0;
|
if (!enum_face_charsets(face, &enum_charsets, proc, lparam)) return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4636,11 +4635,11 @@ DWORD WineEngEnumFonts(LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lparam)
|
||||||
family = LIST_ENTRY(family_elem_ptr, Family, entry);
|
family = LIST_ENTRY(family_elem_ptr, Family, entry);
|
||||||
face_elem_ptr = list_head(&family->faces);
|
face_elem_ptr = list_head(&family->faces);
|
||||||
face = LIST_ENTRY(face_elem_ptr, Face, entry);
|
face = LIST_ENTRY(face_elem_ptr, Face, entry);
|
||||||
if (!enum_face_charsets(face, &enum_charsets, proc, lparam)) return 0;
|
if (!enum_face_charsets(face, &enum_charsets, proc, lparam)) return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LeaveCriticalSection( &freetype_cs );
|
LeaveCriticalSection( &freetype_cs );
|
||||||
return 1;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FTVectorToPOINTFX(FT_Vector *vec, POINTFX *pt)
|
static void FTVectorToPOINTFX(FT_Vector *vec, POINTFX *pt)
|
||||||
|
@ -7074,7 +7073,7 @@ static const struct gdi_dc_funcs freetype_funcs =
|
||||||
NULL, /* pEndDoc */
|
NULL, /* pEndDoc */
|
||||||
NULL, /* pEndPage */
|
NULL, /* pEndPage */
|
||||||
NULL, /* pEndPath */
|
NULL, /* pEndPath */
|
||||||
NULL, /* pEnumDeviceFonts */
|
freetype_EnumDeviceFonts, /* pEnumDeviceFonts */
|
||||||
NULL, /* pEnumICMProfiles */
|
NULL, /* pEnumICMProfiles */
|
||||||
NULL, /* pExcludeClipRect */
|
NULL, /* pExcludeClipRect */
|
||||||
NULL, /* pExtDeviceMode */
|
NULL, /* pExtDeviceMode */
|
||||||
|
@ -7185,11 +7184,6 @@ BOOL WineEngDestroyFontInstance(HFONT hfont)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WineEngEnumFonts(LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lparam)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
|
DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
|
||||||
LPWORD pgi, DWORD flags)
|
LPWORD pgi, DWORD flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -292,7 +292,6 @@ typedef struct
|
||||||
extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
|
extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
|
||||||
extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
|
extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
|
||||||
extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
|
extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
|
||||||
extern DWORD WineEngEnumFonts(LPLOGFONTW, FONTENUMPROCW, LPARAM) DECLSPEC_HIDDEN;
|
|
||||||
extern BOOL WineEngGetCharABCWidths(GdiFont *font, UINT firstChar,
|
extern BOOL WineEngGetCharABCWidths(GdiFont *font, UINT firstChar,
|
||||||
UINT lastChar, LPABC buffer) DECLSPEC_HIDDEN;
|
UINT lastChar, LPABC buffer) DECLSPEC_HIDDEN;
|
||||||
extern BOOL WineEngGetCharABCWidthsFloat(GdiFont *font, UINT firstChar,
|
extern BOOL WineEngGetCharABCWidthsFloat(GdiFont *font, UINT firstChar,
|
||||||
|
|
|
@ -428,13 +428,17 @@ static UINT PSDRV_GetFontMetric(HDC hdc, const AFM *afm,
|
||||||
BOOL PSDRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lp )
|
BOOL PSDRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lp )
|
||||||
{
|
{
|
||||||
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
|
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
|
||||||
|
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pEnumDeviceFonts );
|
||||||
ENUMLOGFONTEXW lf;
|
ENUMLOGFONTEXW lf;
|
||||||
NEWTEXTMETRICEXW tm;
|
NEWTEXTMETRICEXW tm;
|
||||||
BOOL b, bRet = 0;
|
BOOL ret;
|
||||||
AFMLISTENTRY *afmle;
|
AFMLISTENTRY *afmle;
|
||||||
FONTFAMILY *family;
|
FONTFAMILY *family;
|
||||||
char FaceName[LF_FACESIZE];
|
char FaceName[LF_FACESIZE];
|
||||||
|
|
||||||
|
ret = next->funcs->pEnumDeviceFonts( next, plf, proc, lp );
|
||||||
|
if (!ret) return FALSE;
|
||||||
|
|
||||||
if( plf && plf->lfFaceName[0] ) {
|
if( plf && plf->lfFaceName[0] ) {
|
||||||
WideCharToMultiByte(CP_ACP, 0, plf->lfFaceName, -1,
|
WideCharToMultiByte(CP_ACP, 0, plf->lfFaceName, -1,
|
||||||
FaceName, sizeof(FaceName), NULL, NULL);
|
FaceName, sizeof(FaceName), NULL, NULL);
|
||||||
|
@ -450,9 +454,8 @@ BOOL PSDRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LPA
|
||||||
|
|
||||||
TRACE("Got '%s'\n", afmle->afm->FontName);
|
TRACE("Got '%s'\n", afmle->afm->FontName);
|
||||||
fm = PSDRV_GetFontMetric( dev->hdc, afmle->afm, &tm, &lf );
|
fm = PSDRV_GetFontMetric( dev->hdc, afmle->afm, &tm, &lf );
|
||||||
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, fm, lp )) )
|
if (!(ret = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, fm, lp )))
|
||||||
bRet = b;
|
break;
|
||||||
else break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -464,10 +467,9 @@ BOOL PSDRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LPA
|
||||||
afmle = family->afmlist;
|
afmle = family->afmlist;
|
||||||
TRACE("Got '%s'\n", afmle->afm->FontName);
|
TRACE("Got '%s'\n", afmle->afm->FontName);
|
||||||
fm = PSDRV_GetFontMetric( dev->hdc, afmle->afm, &tm, &lf );
|
fm = PSDRV_GetFontMetric( dev->hdc, afmle->afm, &tm, &lf );
|
||||||
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, fm, lp )) )
|
if (!(ret = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, fm, lp )))
|
||||||
bRet = b;
|
break;
|
||||||
else break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bRet;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3326,14 +3326,18 @@ HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont )
|
||||||
BOOL X11DRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lp )
|
BOOL X11DRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LPARAM lp )
|
||||||
{
|
{
|
||||||
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
||||||
|
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pEnumDeviceFonts );
|
||||||
ENUMLOGFONTEXW lf;
|
ENUMLOGFONTEXW lf;
|
||||||
NEWTEXTMETRICEXW tm;
|
NEWTEXTMETRICEXW tm;
|
||||||
fontResource* pfr = fontList;
|
fontResource* pfr = fontList;
|
||||||
BOOL b, bRet = 0;
|
BOOL ret;
|
||||||
LOGFONTW lfW;
|
LOGFONTW lfW;
|
||||||
|
|
||||||
|
ret = next->funcs->pEnumDeviceFonts( next, plf, proc, lp );
|
||||||
|
if (!ret) return FALSE;
|
||||||
|
|
||||||
/* 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 (physDev->has_gdi_font) return FALSE;
|
if (physDev->has_gdi_font) return ret;
|
||||||
|
|
||||||
if (!plf)
|
if (!plf)
|
||||||
{
|
{
|
||||||
|
@ -3362,9 +3366,8 @@ BOOL X11DRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LP
|
||||||
plf->lfCharSet == pfi->df.dfCharSet) {
|
plf->lfCharSet == pfi->df.dfCharSet) {
|
||||||
UINT xfm = XFONT_GetFontMetric( pfi, &lf, &tm );
|
UINT xfm = XFONT_GetFontMetric( pfi, &lf, &tm );
|
||||||
|
|
||||||
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, xfm, lp )) )
|
if (!(ret = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, xfm, lp )))
|
||||||
bRet = b;
|
break;
|
||||||
else break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3376,12 +3379,11 @@ BOOL X11DRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW proc, LP
|
||||||
{
|
{
|
||||||
UINT xfm = XFONT_GetFontMetric( pfr->fi, &lf, &tm );
|
UINT xfm = XFONT_GetFontMetric( pfr->fi, &lf, &tm );
|
||||||
|
|
||||||
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, xfm, lp )) )
|
if (!(ret = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, xfm, lp )))
|
||||||
bRet = b;
|
break;
|
||||||
else break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bRet;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue