mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 13:39:08 +02:00
CairoCanvas, for alignment, logical rect should be used instead of ink rect, fix alignment to the right
git-svn-id: trunk@40722 -
This commit is contained in:
parent
8fc6a8eb4b
commit
a471e2d12c
@ -934,9 +934,9 @@ begin
|
||||
pango_layout_set_text(layout, pchar(s1), -1);
|
||||
pango_layout_get_extents(Layout, @ink, @logical);
|
||||
case Style.Alignment of
|
||||
taLeftJustify: x := StartLeft;
|
||||
taCenter: x := BoxLeft + BoxWidth/2 - ink.width/PANGO_SCALE/2;
|
||||
taRightJustify: x := BoxLeft+BoxWidth - ink.Width/PANGO_SCALE;
|
||||
taLeftJustify: x := StartLeft;
|
||||
taCenter: x := BoxLeft + BoxWidth/2 - logical.width/PANGO_SCALE/2;
|
||||
taRightJustify: x := BoxLeft+BoxWidth - logical.Width/PANGO_SCALE;
|
||||
end;
|
||||
cairo_move_to(cr, x, y);
|
||||
//DebugLn('TextRect ',S1);
|
||||
|
@ -233,9 +233,11 @@ procedure TForm1.DrawOther(cnv: TCanvas; XDPI, YDPI: Integer);
|
||||
const
|
||||
CTEXT='Hola';
|
||||
Par =
|
||||
'Uno' + LineEnding+
|
||||
'noU' + LineEnding+
|
||||
'oUn' + LineEnding+
|
||||
'1.111' + LineEnding+
|
||||
'0.000' + LineEnding+
|
||||
'.101' + LineEnding+
|
||||
'M.Unl' + LineEnding+
|
||||
'.UnlM' + LineEnding+
|
||||
'01.' + LineEnding+
|
||||
'1.0' + LineEnding+
|
||||
'.01';
|
||||
@ -269,7 +271,7 @@ begin
|
||||
cnv.TextOut(R.Left, R.Top, 'Line3'); OffsetRect(R, 0, sz.cy);
|
||||
|
||||
R := Rect(XDPI*4, YDPI*2, Round(XDPI*6), round(YDPI*6));
|
||||
cnv.Font.Name := 'Arial';
|
||||
cnv.Font.Name := 'Sans';
|
||||
cnv.Font.Size := 40;
|
||||
cnv.Font.Color := clGreen;
|
||||
cnv.Brush.Style := bsClear;
|
||||
|
Loading…
Reference in New Issue
Block a user