Implement GdiGetCharDimensions

Huw D M Davies h.davies1 at physics.ox.ac.uk
Mon Jul 18 10:14:24 CDT 2005


On Mon, Jul 18, 2005 at 05:03:49PM +0200, Alexandre Julliard wrote:
> 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.

Actually GetTextExtentPoint returns tm.tmHeight for cy, so there
shouldn't be any difference.

Huw.
-- 
Huw Davies
huw at codeweavers.com



More information about the wine-devel mailing list