Am 19.02.2023 um 08:00 schrieb Russ via lazarus:
When writing text to the canvas using Canvas.TextRec(), using layout
tlTop and/or alignment taLeftJustify, the text is aligned to the
canvas left and top edges instead of those edges of the text
rectangle. The other layout and alignment cases work correctly.
The sample code below illustrates this for all 9 possible combinations
of layout and alignment.
Changing lines 1302 and 1304 of canvas.inc fixes this problem:
1302: fRect.Left := X; --> fRect.Left := fRect.Left + X;
1304: fRect.Top := Y; --> fRect.Top := fRect.Top + Y;
canvas.inc in Lazarus 2.2.4 and trunk are the same.
Please don't change this - it will break numerous code.
The reported behaviour is compatible with Delphi. What do you think are
the additional x,y parameters good for? Delphi (and Lazarus) interprets
them as the starting point of the text in the case where Layout is tlTop
and Alignment is taLeftJustify, no matter what the Rect parameter is
(which is used a clipping rectangle, though). God knows why x,y are not
interpreted as an offset to the positions defined by Layout/Alignment
directly.
--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus