Commit 441d6cfc authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Implement GetTextFace as a standard driver entry point.

parent a2de6a87
...@@ -434,7 +434,20 @@ static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT ...@@ -434,7 +434,20 @@ static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT
static INT nulldrv_GetTextFace( PHYSDEV dev, INT size, LPWSTR name ) 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 ) static BOOL nulldrv_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
......
...@@ -852,25 +852,14 @@ INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name ) ...@@ -852,25 +852,14 @@ INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name )
*/ */
INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name ) INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name )
{ {
FONTOBJ *font; PHYSDEV dev;
INT ret = 0; INT ret;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
if (!dc) return 0; if (!dc) return 0;
if(dc->gdiFont) dev = GET_DC_PHYSDEV( dc, pGetTextFace );
ret = WineEngGetTextFace(dc->gdiFont, count, name); ret = dev->funcs->pGetTextFace( dev, 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 );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }
......
...@@ -6595,17 +6595,26 @@ DWORD WineEngGetFontData(GdiFont *font, DWORD table, DWORD offset, LPVOID buf, ...@@ -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; INT n;
if(str) { struct freetype_physdev *physdev = get_freetype_dev( dev );
lstrcpynW(str, font->name, count);
return min(count, n); if (!physdev->font)
} else {
return n; 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 = ...@@ -7138,7 +7147,7 @@ static const struct gdi_dc_funcs freetype_funcs =
freetype_GetTextCharsetInfo, /* pGetTextCharsetInfo */ freetype_GetTextCharsetInfo, /* pGetTextCharsetInfo */
freetype_GetTextExtentExPoint, /* pGetTextExtentExPoint */ freetype_GetTextExtentExPoint, /* pGetTextExtentExPoint */
freetype_GetTextExtentExPointI, /* pGetTextExtentExPointI */ freetype_GetTextExtentExPointI, /* pGetTextExtentExPointI */
NULL, /* pGetTextFace */ freetype_GetTextFace, /* pGetTextFace */
freetype_GetTextMetrics, /* pGetTextMetrics */ freetype_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */ NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */ NULL, /* pInvertRgn */
...@@ -7234,12 +7243,6 @@ DWORD WineEngGetFontData(GdiFont *font, DWORD table, DWORD offset, LPVOID buf, ...@@ -7234,12 +7243,6 @@ DWORD WineEngGetFontData(GdiFont *font, DWORD table, DWORD offset, LPVOID buf,
return GDI_ERROR; 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) INT WineEngAddFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv)
{ {
FIXME("(%s, %x, %p): stub\n", debugstr_w(file), flags, pdv); FIXME("(%s, %x, %p): stub\n", debugstr_w(file), flags, pdv);
......
...@@ -294,7 +294,6 @@ extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC ...@@ -294,7 +294,6 @@ extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC
extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN; extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
extern DWORD WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) 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 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 WineEngFontIsLinked(GdiFont*) DECLSPEC_HIDDEN;
extern BOOL WineEngInit(void) DECLSPEC_HIDDEN; extern BOOL WineEngInit(void) DECLSPEC_HIDDEN;
extern BOOL WineEngRealizationInfo(GdiFont*, realization_info_t*) DECLSPEC_HIDDEN; extern BOOL WineEngRealizationInfo(GdiFont*, realization_info_t*) DECLSPEC_HIDDEN;
......
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