Robert Shearman rob@codeweavers.com writes:
+LONG WINAPI GdiGetCharDimensions(HDC hdc, LPTEXTMETRICW lptm, LONG *height) +{
- SIZE sz;
- static const WCHAR alphabet[] = {
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
- if(lptm && !GetTextMetricsW(hdc, lptm)) return 0;
- if(!GetTextExtentPointW(hdc, alphabet, 52, &sz)) return 0;
- if (height) *height = sz.cy;
- return (sz.cx / 26 + 1) / 2;
+}
Again I think you should be using tmHeight instead of sz.cy for the height. Some fonts may well have characters larger than the alphabet ones, and the current behavior is always to use tmHeight.
On Mon, Jul 18, 2005 at 05:03:49PM +0200, Alexandre Julliard wrote:
Robert Shearman rob@codeweavers.com writes:
+LONG WINAPI GdiGetCharDimensions(HDC hdc, LPTEXTMETRICW lptm, LONG *height) +{
- SIZE sz;
- static const WCHAR alphabet[] = {
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H',
'I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',0};
- if(lptm && !GetTextMetricsW(hdc, lptm)) return 0;
- if(!GetTextExtentPointW(hdc, alphabet, 52, &sz)) return 0;
- if (height) *height = sz.cy;
- return (sz.cx / 26 + 1) / 2;
+}
Again I think you should be using tmHeight instead of sz.cy for the height. Some fonts may well have characters larger than the alphabet ones, and the current behavior is always to use tmHeight.
Actually GetTextExtentPoint returns tm.tmHeight for cy, so there shouldn't be any difference.
Huw.
Huw D M Davies h.davies1@physics.ox.ac.uk writes:
Actually GetTextExtentPoint returns tm.tmHeight for cy, so there shouldn't be any difference.
Ah right, in that case of course it makes no difference. But is that really the correct behavior for GetTextExtentPoint?
On Mon, Jul 18, 2005 at 05:24:42PM +0200, Alexandre Julliard wrote:
Huw D M Davies h.davies1@physics.ox.ac.uk writes:
Actually GetTextExtentPoint returns tm.tmHeight for cy, so there shouldn't be any difference.
Ah right, in that case of course it makes no difference. But is that really the correct behavior for GetTextExtentPoint?
Yup. Here's a test.
Huw Davies huw@codeweavers.com Test to show that the height returned by GetTextExtentPoint is the same as tmHeight.