mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 23:40:26 +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
@ -935,8 +935,8 @@ begin
|
|||||||
pango_layout_get_extents(Layout, @ink, @logical);
|
pango_layout_get_extents(Layout, @ink, @logical);
|
||||||
case Style.Alignment of
|
case Style.Alignment of
|
||||||
taLeftJustify: x := StartLeft;
|
taLeftJustify: x := StartLeft;
|
||||||
taCenter: x := BoxLeft + BoxWidth/2 - ink.width/PANGO_SCALE/2;
|
taCenter: x := BoxLeft + BoxWidth/2 - logical.width/PANGO_SCALE/2;
|
||||||
taRightJustify: x := BoxLeft+BoxWidth - ink.Width/PANGO_SCALE;
|
taRightJustify: x := BoxLeft+BoxWidth - logical.Width/PANGO_SCALE;
|
||||||
end;
|
end;
|
||||||
cairo_move_to(cr, x, y);
|
cairo_move_to(cr, x, y);
|
||||||
//DebugLn('TextRect ',S1);
|
//DebugLn('TextRect ',S1);
|
||||||
|
@ -233,9 +233,11 @@ procedure TForm1.DrawOther(cnv: TCanvas; XDPI, YDPI: Integer);
|
|||||||
const
|
const
|
||||||
CTEXT='Hola';
|
CTEXT='Hola';
|
||||||
Par =
|
Par =
|
||||||
'Uno' + LineEnding+
|
'1.111' + LineEnding+
|
||||||
'noU' + LineEnding+
|
'0.000' + LineEnding+
|
||||||
'oUn' + LineEnding+
|
'.101' + LineEnding+
|
||||||
|
'M.Unl' + LineEnding+
|
||||||
|
'.UnlM' + LineEnding+
|
||||||
'01.' + LineEnding+
|
'01.' + LineEnding+
|
||||||
'1.0' + LineEnding+
|
'1.0' + LineEnding+
|
||||||
'.01';
|
'.01';
|
||||||
@ -269,7 +271,7 @@ begin
|
|||||||
cnv.TextOut(R.Left, R.Top, 'Line3'); OffsetRect(R, 0, sz.cy);
|
cnv.TextOut(R.Left, R.Top, 'Line3'); OffsetRect(R, 0, sz.cy);
|
||||||
|
|
||||||
R := Rect(XDPI*4, YDPI*2, Round(XDPI*6), round(YDPI*6));
|
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.Size := 40;
|
||||||
cnv.Font.Color := clGreen;
|
cnv.Font.Color := clGreen;
|
||||||
cnv.Brush.Style := bsClear;
|
cnv.Brush.Style := bsClear;
|
||||||
|
Loading…
Reference in New Issue
Block a user