gdi32: Implement GetTextFace as a standard driver entry point.

This commit is contained in:
Alexandre Julliard 2011-10-20 17:14:53 +02:00
parent a2de6a8766
commit 441d6cfcd4
4 changed files with 37 additions and 33 deletions

View File

@ -434,7 +434,20 @@ static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT
static INT nulldrv_GetTextFace( PHYSDEV dev, INT size, LPWSTR name )
{
return 0;
INT ret = 0;
LOGFONTW font;
HFONT hfont = GetCurrentObject( dev->hdc, OBJ_FONT );
if (GetObjectW( hfont, sizeof(font), &font ))
{
ret = strlenW( font.lfFaceName ) + 1;
if (name)
{
lstrcpynW( name, font.lfFaceName, size );
ret = min( size, ret );
}
}
return ret;
}
static BOOL nulldrv_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )

View File

@ -852,25 +852,14 @@ INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name )
*/
INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name )
{
FONTOBJ *font;
INT ret = 0;
PHYSDEV dev;
INT ret;
DC * dc = get_dc_ptr( hdc );
if (!dc) return 0;
if(dc->gdiFont)
ret = WineEngGetTextFace(dc->gdiFont, count, name);
else if ((font = GDI_GetObjPtr( dc->hFont, OBJ_FONT )))
{
INT n = strlenW(font->logfont.lfFaceName) + 1;
if (name)
{
lstrcpynW( name, font->logfont.lfFaceName, count );
ret = min(count, n);
}
else ret = n;
GDI_ReleaseObj( dc->hFont );
}
dev = GET_DC_PHYSDEV( dc, pGetTextFace );
ret = dev->funcs->pGetTextFace( dev, count, name );
release_dc_ptr( dc );
return ret;
}

View File

@ -6595,17 +6595,26 @@ DWORD WineEngGetFontData(GdiFont *font, DWORD table, DWORD offset, LPVOID buf,
}
/*************************************************************
* WineEngGetTextFace
*
* freetype_GetTextFace
*/
INT WineEngGetTextFace(GdiFont *font, INT count, LPWSTR str)
static INT freetype_GetTextFace( PHYSDEV dev, INT count, LPWSTR str )
{
INT n = strlenW(font->name) + 1;
if(str) {
lstrcpynW(str, font->name, count);
return min(count, n);
} else
return n;
INT n;
struct freetype_physdev *physdev = get_freetype_dev( dev );
if (!physdev->font)
{
dev = GET_NEXT_PHYSDEV( dev, pGetTextFace );
return dev->funcs->pGetTextFace( dev, count, str );
}
n = strlenW(physdev->font->name) + 1;
if (str)
{
lstrcpynW(str, physdev->font->name, count);
n = min(count, n);
}
return n;
}
/*************************************************************
@ -7138,7 +7147,7 @@ static const struct gdi_dc_funcs freetype_funcs =
freetype_GetTextCharsetInfo, /* pGetTextCharsetInfo */
freetype_GetTextExtentExPoint, /* pGetTextExtentExPoint */
freetype_GetTextExtentExPointI, /* pGetTextExtentExPointI */
NULL, /* pGetTextFace */
freetype_GetTextFace, /* pGetTextFace */
freetype_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */
@ -7234,12 +7243,6 @@ DWORD WineEngGetFontData(GdiFont *font, DWORD table, DWORD offset, LPVOID buf,
return GDI_ERROR;
}
INT WineEngGetTextFace(GdiFont *font, INT count, LPWSTR str)
{
ERR("called but we don't have FreeType\n");
return 0;
}
INT WineEngAddFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv)
{
FIXME("(%s, %x, %p): stub\n", debugstr_w(file), flags, pdv);

View File

@ -294,7 +294,6 @@ extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC
extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
extern DWORD WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN;
extern BOOL WineEngGetLinkedHFont(DC *dc, WCHAR c, HFONT *new_hfont, UINT *glyph) DECLSPEC_HIDDEN;
extern INT WineEngGetTextFace(GdiFont*, INT, LPWSTR) DECLSPEC_HIDDEN;
extern BOOL WineEngFontIsLinked(GdiFont*) DECLSPEC_HIDDEN;
extern BOOL WineEngInit(void) DECLSPEC_HIDDEN;
extern BOOL WineEngRealizationInfo(GdiFont*, realization_info_t*) DECLSPEC_HIDDEN;