gdi32: Implement GetOutlineTextMetrics as a standard driver entry point.
This commit is contained in:
parent
0c96820104
commit
ce8d7b4601
@ -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) {
|
||||
output = HeapAlloc(GetProcessHeap(), 0, ret);
|
||||
WineEngGetOutlineTextMetrics(dc->gdiFont, ret, output);
|
||||
}
|
||||
dev = GET_DC_PHYSDEV( dc, pGetOutlineTextMetrics );
|
||||
ret = dev->funcs->pGetOutlineTextMetrics( dev, cbData, output );
|
||||
|
||||
if (lpOTM && ret > cbData)
|
||||
{
|
||||
output = HeapAlloc(GetProcessHeap(), 0, ret);
|
||||
ret = dev->funcs->pGetOutlineTextMetrics( dev, ret, output );
|
||||
}
|
||||
|
||||
if (lpOTM && ret)
|
||||
{
|
||||
output->otmTextMetrics.tmDigitizedAspectX = GetDeviceCaps(hdc, LOGPIXELSX);
|
||||
output->otmTextMetrics.tmDigitizedAspectY = GetDeviceCaps(hdc, LOGPIXELSY);
|
||||
|
||||
@ -1473,65 +1477,46 @@ UINT WINAPI GetOutlineTextMetricsW(
|
||||
(-abs(INTERNAL_YDSTOWS(dc, (y)))): \
|
||||
(abs(INTERNAL_YDSTOWS(dc, (y)))))
|
||||
|
||||
output->otmTextMetrics.tmHeight = HDPTOLP(output->otmTextMetrics.tmHeight);
|
||||
output->otmTextMetrics.tmAscent = HDPTOLP(output->otmTextMetrics.tmAscent);
|
||||
output->otmTextMetrics.tmDescent = HDPTOLP(output->otmTextMetrics.tmDescent);
|
||||
output->otmTextMetrics.tmInternalLeading = HDPTOLP(output->otmTextMetrics.tmInternalLeading);
|
||||
output->otmTextMetrics.tmExternalLeading = HDPTOLP(output->otmTextMetrics.tmExternalLeading);
|
||||
output->otmTextMetrics.tmAveCharWidth = WDPTOLP(output->otmTextMetrics.tmAveCharWidth);
|
||||
output->otmTextMetrics.tmMaxCharWidth = WDPTOLP(output->otmTextMetrics.tmMaxCharWidth);
|
||||
output->otmTextMetrics.tmOverhang = WDPTOLP(output->otmTextMetrics.tmOverhang);
|
||||
output->otmAscent = HDPTOLP(output->otmAscent);
|
||||
output->otmDescent = HDPTOLP(output->otmDescent);
|
||||
output->otmLineGap = abs(INTERNAL_YDSTOWS(dc,output->otmLineGap));
|
||||
output->otmsCapEmHeight = abs(INTERNAL_YDSTOWS(dc,output->otmsCapEmHeight));
|
||||
output->otmsXHeight = abs(INTERNAL_YDSTOWS(dc,output->otmsXHeight));
|
||||
output->otmrcFontBox.top = HDPTOLP(output->otmrcFontBox.top);
|
||||
output->otmrcFontBox.bottom = HDPTOLP(output->otmrcFontBox.bottom);
|
||||
output->otmrcFontBox.left = WDPTOLP(output->otmrcFontBox.left);
|
||||
output->otmrcFontBox.right = WDPTOLP(output->otmrcFontBox.right);
|
||||
output->otmMacAscent = HDPTOLP(output->otmMacAscent);
|
||||
output->otmMacDescent = HDPTOLP(output->otmMacDescent);
|
||||
output->otmMacLineGap = abs(INTERNAL_YDSTOWS(dc,output->otmMacLineGap));
|
||||
output->otmptSubscriptSize.x = WDPTOLP(output->otmptSubscriptSize.x);
|
||||
output->otmptSubscriptSize.y = HDPTOLP(output->otmptSubscriptSize.y);
|
||||
output->otmptSubscriptOffset.x = WDPTOLP(output->otmptSubscriptOffset.x);
|
||||
output->otmptSubscriptOffset.y = HDPTOLP(output->otmptSubscriptOffset.y);
|
||||
output->otmptSuperscriptSize.x = WDPTOLP(output->otmptSuperscriptSize.x);
|
||||
output->otmptSuperscriptSize.y = HDPTOLP(output->otmptSuperscriptSize.y);
|
||||
output->otmptSuperscriptOffset.x = WDPTOLP(output->otmptSuperscriptOffset.x);
|
||||
output->otmptSuperscriptOffset.y = HDPTOLP(output->otmptSuperscriptOffset.y);
|
||||
output->otmsStrikeoutSize = abs(INTERNAL_YDSTOWS(dc,output->otmsStrikeoutSize));
|
||||
output->otmsStrikeoutPosition = HDPTOLP(output->otmsStrikeoutPosition);
|
||||
output->otmsUnderscoreSize = HDPTOLP(output->otmsUnderscoreSize);
|
||||
output->otmsUnderscorePosition = HDPTOLP(output->otmsUnderscorePosition);
|
||||
output->otmTextMetrics.tmHeight = HDPTOLP(output->otmTextMetrics.tmHeight);
|
||||
output->otmTextMetrics.tmAscent = HDPTOLP(output->otmTextMetrics.tmAscent);
|
||||
output->otmTextMetrics.tmDescent = HDPTOLP(output->otmTextMetrics.tmDescent);
|
||||
output->otmTextMetrics.tmInternalLeading = HDPTOLP(output->otmTextMetrics.tmInternalLeading);
|
||||
output->otmTextMetrics.tmExternalLeading = HDPTOLP(output->otmTextMetrics.tmExternalLeading);
|
||||
output->otmTextMetrics.tmAveCharWidth = WDPTOLP(output->otmTextMetrics.tmAveCharWidth);
|
||||
output->otmTextMetrics.tmMaxCharWidth = WDPTOLP(output->otmTextMetrics.tmMaxCharWidth);
|
||||
output->otmTextMetrics.tmOverhang = WDPTOLP(output->otmTextMetrics.tmOverhang);
|
||||
output->otmAscent = HDPTOLP(output->otmAscent);
|
||||
output->otmDescent = HDPTOLP(output->otmDescent);
|
||||
output->otmLineGap = abs(INTERNAL_YDSTOWS(dc,output->otmLineGap));
|
||||
output->otmsCapEmHeight = abs(INTERNAL_YDSTOWS(dc,output->otmsCapEmHeight));
|
||||
output->otmsXHeight = abs(INTERNAL_YDSTOWS(dc,output->otmsXHeight));
|
||||
output->otmrcFontBox.top = HDPTOLP(output->otmrcFontBox.top);
|
||||
output->otmrcFontBox.bottom = HDPTOLP(output->otmrcFontBox.bottom);
|
||||
output->otmrcFontBox.left = WDPTOLP(output->otmrcFontBox.left);
|
||||
output->otmrcFontBox.right = WDPTOLP(output->otmrcFontBox.right);
|
||||
output->otmMacAscent = HDPTOLP(output->otmMacAscent);
|
||||
output->otmMacDescent = HDPTOLP(output->otmMacDescent);
|
||||
output->otmMacLineGap = abs(INTERNAL_YDSTOWS(dc,output->otmMacLineGap));
|
||||
output->otmptSubscriptSize.x = WDPTOLP(output->otmptSubscriptSize.x);
|
||||
output->otmptSubscriptSize.y = HDPTOLP(output->otmptSubscriptSize.y);
|
||||
output->otmptSubscriptOffset.x = WDPTOLP(output->otmptSubscriptOffset.x);
|
||||
output->otmptSubscriptOffset.y = HDPTOLP(output->otmptSubscriptOffset.y);
|
||||
output->otmptSuperscriptSize.x = WDPTOLP(output->otmptSuperscriptSize.x);
|
||||
output->otmptSuperscriptSize.y = HDPTOLP(output->otmptSuperscriptSize.y);
|
||||
output->otmptSuperscriptOffset.x = WDPTOLP(output->otmptSuperscriptOffset.x);
|
||||
output->otmptSuperscriptOffset.y = HDPTOLP(output->otmptSuperscriptOffset.y);
|
||||
output->otmsStrikeoutSize = abs(INTERNAL_YDSTOWS(dc,output->otmsStrikeoutSize));
|
||||
output->otmsStrikeoutPosition = HDPTOLP(output->otmsStrikeoutPosition);
|
||||
output->otmsUnderscoreSize = HDPTOLP(output->otmsUnderscoreSize);
|
||||
output->otmsUnderscorePosition = HDPTOLP(output->otmsUnderscorePosition);
|
||||
#undef WDPTOLP
|
||||
#undef HDPTOLP
|
||||
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
|
||||
*/
|
||||
}
|
||||
}
|
||||
if(output != lpOTM)
|
||||
{
|
||||
memcpy(lpOTM, output, cbData);
|
||||
HeapFree(GetProcessHeap(), 0, output);
|
||||
ret = cbData;
|
||||
}
|
||||
}
|
||||
release_dc_ptr(dc);
|
||||
return ret;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user