From 23345fe0557bdd6e6f6bc129529ca5f6e24baaa6 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 30 Aug 2021 13:54:09 +0200 Subject: [PATCH] gdi32: Move a few font functions to text.c. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/gdi32/font.c | 62 ----------------------------------------------- dlls/gdi32/text.c | 54 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 62 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index e5aae614f3b..0be27eb0978 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -5518,16 +5518,6 @@ done: } -/*********************************************************************** - * GetAspectRatioFilterEx (GDI32.@) - */ -BOOL WINAPI GetAspectRatioFilterEx( HDC hdc, LPSIZE pAspectRatio ) -{ - FIXME("(%p, %p): -- Empty Stub !\n", hdc, pAspectRatio); - return FALSE; -} - - /****************************************************************************** * NtGdiGetCharABCWidthsW (win32u.@) * @@ -6682,58 +6672,6 @@ BOOL WINAPI GetFontResourceInfoW( LPCWSTR str, LPDWORD size, PVOID buffer, DWORD return FALSE; } -/*********************************************************************** - * GetTextCharset (GDI32.@) - */ -UINT WINAPI GetTextCharset(HDC hdc) -{ - /* MSDN docs say this is equivalent */ - return NtGdiGetTextCharsetInfo( hdc, NULL, 0 ); -} - -/*********************************************************************** - * GdiGetCharDimensions (GDI32.@) - * - * Gets the average width of the characters in the English alphabet. - * - * PARAMS - * hdc [I] Handle to the device context to measure on. - * lptm [O] Pointer to memory to store the text metrics into. - * height [O] On exit, the maximum height of characters in the English alphabet. - * - * RETURNS - * The average width of characters in the English alphabet. - * - * NOTES - * This function is used by the dialog manager to get the size of a dialog - * unit. It should also be used by other pieces of code that need to know - * the size of a dialog unit in logical units without having access to the - * window handle of the dialog. - * Windows caches the font metrics from this function, but we don't and - * there doesn't appear to be an immediate advantage to do so. - * - * SEE ALSO - * GetTextExtentPointW, GetTextMetricsW, MapDialogRect. - */ -LONG WINAPI GdiGetCharDimensions(HDC hdc, LPTEXTMETRICW lptm, LONG *height) -{ - SIZE sz; - - if(lptm && !GetTextMetricsW(hdc, lptm)) return 0; - - if(!GetTextExtentPointW(hdc, L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 52, &sz)) - return 0; - - if (height) *height = sz.cy; - return (sz.cx / 26 + 1) / 2; -} - -BOOL WINAPI EnableEUDC(BOOL fEnableEUDC) -{ - FIXME("(%d): stub\n", fEnableEUDC); - return FALSE; -} - /*********************************************************************** * GetFontUnicodeRanges (GDI32.@) * diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c index 149b7f081ed..98840af111d 100644 --- a/dlls/gdi32/text.c +++ b/dlls/gdi32/text.c @@ -1914,3 +1914,57 @@ DWORD WINAPI GetGlyphIndicesA( HDC hdc, const char *str, INT count, WORD *indice HeapFree( GetProcessHeap(), 0, strW ); return ret; } + +/*********************************************************************** + * GetAspectRatioFilterEx (GDI32.@) + */ +BOOL WINAPI GetAspectRatioFilterEx( HDC hdc, SIZE *aspect_ratio ) +{ + FIXME( "(%p, %p): stub\n", hdc, aspect_ratio ); + return FALSE; +} + +/*********************************************************************** + * GetTextCharset (GDI32.@) + */ +UINT WINAPI GetTextCharset( HDC hdc ) +{ + /* MSDN docs say this is equivalent */ + return NtGdiGetTextCharsetInfo( hdc, NULL, 0 ); +} + +/*********************************************************************** + * GdiGetCharDimensions (GDI32.@) + * + * Gets the average width of the characters in the English alphabet. + * + * NOTES + * This function is used by the dialog manager to get the size of a dialog + * unit. It should also be used by other pieces of code that need to know + * the size of a dialog unit in logical units without having access to the + * window handle of the dialog. + * Windows caches the font metrics from this function, but we don't and + * there doesn't appear to be an immediate advantage to do so. + */ +LONG WINAPI GdiGetCharDimensions( HDC hdc, TEXTMETRICW *metric, LONG *height ) +{ + SIZE sz; + + if (metric && !GetTextMetricsW( hdc, metric )) return 0; + + if (!GetTextExtentPointW( hdc, L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + 52, &sz )) + return 0; + + if (height) *height = sz.cy; + return (sz.cx / 26 + 1) / 2; +} + +/*********************************************************************** + * EnableEUDC (GDI32.@) + */ +BOOL WINAPI EnableEUDC( BOOL enable ) +{ + FIXME( "(%d): stub\n", enable ); + return FALSE; +}