gdi32: Implement GetTextMetrics as a standard driver entry point.

This commit is contained in:
Alexandre Julliard 2011-10-19 14:12:23 +02:00
parent ca4177997c
commit 20070d0838
3 changed files with 14 additions and 19 deletions

View File

@ -1222,17 +1222,13 @@ BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics )
*/ */
BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics ) BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
{ {
PHYSDEV physdev;
BOOL ret = FALSE; BOOL ret = FALSE;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->gdiFont) physdev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
ret = WineEngGetTextMetrics(dc->gdiFont, metrics); ret = physdev->funcs->pGetTextMetrics( physdev, metrics );
else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
ret = physdev->funcs->pGetTextMetrics( physdev, metrics );
}
if (ret) if (ret)
{ {

View File

@ -6209,16 +6209,22 @@ DWORD WineEngGetGlyphOutline(GdiFont *font, UINT glyph, UINT format,
} }
/************************************************************* /*************************************************************
* WineEngGetTextMetrics * freetype_GetTextMetrics
*
*/ */
BOOL WineEngGetTextMetrics(GdiFont *font, LPTEXTMETRICW ptm) static BOOL freetype_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
{ {
struct freetype_physdev *physdev = get_freetype_dev( dev );
BOOL ret; BOOL ret;
if (!physdev->font)
{
dev = GET_NEXT_PHYSDEV( dev, pGetTextMetrics );
return dev->funcs->pGetTextMetrics( dev, metrics );
}
GDI_CheckNotLock(); GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs ); EnterCriticalSection( &freetype_cs );
ret = get_text_metrics( font, ptm ); ret = get_text_metrics( physdev->font, metrics );
LeaveCriticalSection( &freetype_cs ); LeaveCriticalSection( &freetype_cs );
return ret; return ret;
} }
@ -7089,7 +7095,7 @@ static const struct gdi_dc_funcs freetype_funcs =
NULL, /* pGetPixelFormat */ NULL, /* pGetPixelFormat */
NULL, /* pGetSystemPaletteEntries */ NULL, /* pGetSystemPaletteEntries */
freetype_GetTextExtentExPoint, /* pGetTextExtentExPoint */ freetype_GetTextExtentExPoint, /* pGetTextExtentExPoint */
NULL, /* pGetTextMetrics */ freetype_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */ NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */ NULL, /* pInvertRgn */
NULL, /* pLineTo */ NULL, /* pLineTo */
@ -7196,12 +7202,6 @@ DWORD WineEngGetGlyphOutline(GdiFont *font, UINT glyph, UINT format,
return GDI_ERROR; return GDI_ERROR;
} }
BOOL WineEngGetTextMetrics(GdiFont *font, LPTEXTMETRICW ptm)
{
ERR("called but we don't have FreeType\n");
return FALSE;
}
UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize, UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
OUTLINETEXTMETRICW *potm) OUTLINETEXTMETRICW *potm)
{ {

View File

@ -312,7 +312,6 @@ extern UINT WineEngGetOutlineTextMetrics(GdiFont*, UINT, LPOUTLINETEXTMETRICW) D
extern UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) DECLSPEC_HIDDEN; extern UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) DECLSPEC_HIDDEN;
extern BOOL WineEngGetTextExtentExPointI(GdiFont*, const WORD *, INT, INT, LPINT, LPINT, LPSIZE) DECLSPEC_HIDDEN; extern BOOL WineEngGetTextExtentExPointI(GdiFont*, const WORD *, INT, INT, LPINT, LPINT, LPSIZE) DECLSPEC_HIDDEN;
extern INT WineEngGetTextFace(GdiFont*, INT, LPWSTR) DECLSPEC_HIDDEN; extern INT WineEngGetTextFace(GdiFont*, INT, LPWSTR) DECLSPEC_HIDDEN;
extern BOOL WineEngGetTextMetrics(GdiFont*, LPTEXTMETRICW) 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;