gdi32: Implement GetOutlineTextMetrics as a standard driver entry point.

This commit is contained in:
Alexandre Julliard 2011-10-20 16:49:18 +02:00
parent 0c96820104
commit ce8d7b4601
3 changed files with 66 additions and 84 deletions

View File

@ -1450,19 +1450,23 @@ UINT WINAPI GetOutlineTextMetricsW(
{
DC *dc = get_dc_ptr( hdc );
OUTLINETEXTMETRICW *output = lpOTM;
PHYSDEV dev;
UINT ret;
TRACE("(%p,%d,%p)\n", hdc, cbData, lpOTM);
if(!dc) return 0;
if(dc->gdiFont) {
ret = WineEngGetOutlineTextMetrics(dc->gdiFont, cbData, output);
if(lpOTM && ret) {
if(ret > cbData) {
dev = GET_DC_PHYSDEV( dc, pGetOutlineTextMetrics );
ret = dev->funcs->pGetOutlineTextMetrics( dev, cbData, output );
if (lpOTM && ret > cbData)
{
output = HeapAlloc(GetProcessHeap(), 0, ret);
WineEngGetOutlineTextMetrics(dc->gdiFont, ret, output);
ret = dev->funcs->pGetOutlineTextMetrics( dev, ret, output );
}
if (lpOTM && ret)
{
output->otmTextMetrics.tmDigitizedAspectX = GetDeviceCaps(hdc, LOGPIXELSX);
output->otmTextMetrics.tmDigitizedAspectY = GetDeviceCaps(hdc, LOGPIXELSY);
@ -1507,32 +1511,13 @@ UINT WINAPI GetOutlineTextMetricsW(
output->otmsUnderscorePosition = HDPTOLP(output->otmsUnderscorePosition);
#undef WDPTOLP
#undef HDPTOLP
if(output != lpOTM) {
if(output != lpOTM)
{
memcpy(lpOTM, output, cbData);
HeapFree(GetProcessHeap(), 0, output);
ret = cbData;
}
}
}
else { /* This stuff was in GetOutlineTextMetricsA, I've moved it here
but really this should just be a return 0. */
ret = sizeof(*lpOTM);
if (lpOTM) {
if(cbData < ret)
ret = 0;
else {
memset(lpOTM, 0, ret);
lpOTM->otmSize = sizeof(*lpOTM);
GetTextMetricsW(hdc, &lpOTM->otmTextMetrics);
/*
Further fill of the structure not implemented,
Needs real values for the structure members
*/
}
}
}
release_dc_ptr(dc);
return ret;
}

View File

@ -6239,29 +6239,34 @@ static BOOL freetype_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
}
/*************************************************************
* WineEngGetOutlineTextMetrics
*
* freetype_GetOutlineTextMetrics
*/
UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
OUTLINETEXTMETRICW *potm)
static UINT freetype_GetOutlineTextMetrics( PHYSDEV dev, UINT cbSize, OUTLINETEXTMETRICW *potm )
{
struct freetype_physdev *physdev = get_freetype_dev( dev );
UINT ret = 0;
TRACE("font=%p\n", font);
if (!physdev->font)
{
dev = GET_NEXT_PHYSDEV( dev, pGetOutlineTextMetrics );
return dev->funcs->pGetOutlineTextMetrics( dev, cbSize, potm );
}
if (!FT_IS_SCALABLE( font->ft_face )) return 0;
TRACE("font=%p\n", physdev->font);
if (!FT_IS_SCALABLE( physdev->font->ft_face )) return 0;
GDI_CheckNotLock();
EnterCriticalSection( &freetype_cs );
if (font->potm || get_outline_text_metrics( font ))
if (physdev->font->potm || get_outline_text_metrics( physdev->font ))
{
if(cbSize >= font->potm->otmSize)
if(cbSize >= physdev->font->potm->otmSize)
{
memcpy(potm, font->potm, font->potm->otmSize);
scale_outline_font_metrics(font, potm);
memcpy(potm, physdev->font->potm, physdev->font->potm->otmSize);
scale_outline_font_metrics(physdev->font, potm);
}
ret = font->potm->otmSize;
ret = physdev->font->potm->otmSize;
}
LeaveCriticalSection( &freetype_cs );
return ret;
@ -7110,7 +7115,7 @@ static const struct gdi_dc_funcs freetype_funcs =
NULL, /* pGetImage */
freetype_GetKerningPairs, /* pGetKerningPairs */
NULL, /* pGetNearestColor */
NULL, /* pGetOutlineTextMetrics */
freetype_GetOutlineTextMetrics, /* pGetOutlineTextMetrics */
NULL, /* pGetPixel */
NULL, /* pGetPixelFormat */
NULL, /* pGetSystemPaletteEntries */
@ -7206,13 +7211,6 @@ BOOL WineEngDestroyFontInstance(HFONT hfont)
return FALSE;
}
UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
OUTLINETEXTMETRICW *potm)
{
ERR("called but we don't have FreeType\n");
return 0;
}
BOOL WineEngGetTextExtentExPointI(GdiFont *font, const WORD *indices, INT count,
INT max_ext, LPINT nfit, LPINT dx, LPSIZE size)
{

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 UINT WineEngGetOutlineTextMetrics(GdiFont*, UINT, LPOUTLINETEXTMETRICW) 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 INT WineEngGetTextFace(GdiFont*, INT, LPWSTR) DECLSPEC_HIDDEN;