[Lazarus] GetTextExtent on Windows

Marc Weustink marc at dommelstein.nl
Sun Sep 13 22:09:46 CEST 2015

On September 12, 2015 2:12:32 PM GMT+02:00, "J├╝rgen Hestermann" <juergen.hestermann at gmx.de> wrote:
>I use "LCLIntf.DrawText" for drawing text on the screen and
>to determine its width to increment a TRect for the next text output.
>But these functions cause some trouble with drawing (UTF-8-) text on
>In general it works okay but sometimes peculiar clipping or other pixel
>differences occur.
>Are the functions above the correct ones to draw and measure text?
>After looking a bit at the code I saw that in the file
>"intfbasewinapi.inc" almost
>everywhere the Windows API function "GetTextExtentPoint" is used to
>determine text metrics.
>"This function is provided only for compatibility with 16-bit versions
>of Windows.
>Applications should call the *GetTextExtentPoint32*
>function, which provides more accurate results."
>I think many of my problems come from using this deprecated API
>Are there any plans to change this?

If you had a look at the win32 implementation of GetTextExtentPoint then you would have seen that GetTextExtentPoint32 is used internally. 


More information about the Lazarus mailing list