Implement GdiGetCharDimensions

Alexandre Julliard julliard at winehq.org
Mon Jul 18 10:03:49 CDT 2005


Robert Shearman <rob at 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.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list