[Lazarus] GetTextExtent on Windows

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Sep 14 18:31:50 CEST 2015


On Mon, 14 Sep 2015 18:16:19 +0200
J├╝rgen Hestermann <juergen.hestermann at gmx.de> wrote:

>[...]
> > If you had a look at the win32 implementation of GetTextExtentPoint then you would have seen that GetTextExtentPoint32 is used internally.
> >
> Realy?
> Where do you find this?
> I only find the opposite.
> When I follow where Canvas.TextWidth comes from
> I end up on in this function from "canvas.inc" (line 1763):
> 
> function TCanvas.TextExtent(const Text: string): TSize;
> begin
> Result.cX := 0;
> Result.cY := 0;
> if Text='' then exit;
> RequiredState([csHandleValid, csFontValid]);
> GetTextExtentPoint(FHandle, PChar(Text), Length(Text), Result);
> end;
> 
> Even more, there is a function declaration for "GetTextExtendPoint32"
> but it still uses "GetTextExtendPoint" (line 1162 in "intfbasewinapi.inc"):
> 
> function TWidgetSet.GetTextExtentPoint32(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
> begin
> Result := GetTextExtentPoint(DC,Str,Count,Size);
> end;

TWidgetSet is the base class.
TWin32WidgetSet overrides the base class TWidgetSet.

Mattias




More information about the Lazarus mailing list