mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 21:59:15 +02:00
LazReport, fix right alignment text on export to PDF, from Tony Whyman, issue #23138
git-svn-id: trunk@39231 -
This commit is contained in:
parent
247ef8e729
commit
2c72395c0d
@ -438,25 +438,29 @@ end;
|
||||
procedure TfrTNPDFExportFilter.OnText(X, Y: Integer; const Text: string;
|
||||
View: TfrView);
|
||||
var
|
||||
PRTLabel: TPRText;
|
||||
PRTLabel: TPRLabel;
|
||||
nx, ny,
|
||||
ndx, ndy: Integer;
|
||||
gapx, gapy: integer;
|
||||
begin
|
||||
nx := Round(x * PDFEscx) + 1;
|
||||
ny := Round(y * PDFEscy) + 1;
|
||||
ndx := Round(View.dx * PDFEscx);
|
||||
ndy := Round(View.dy * PDFEscy);
|
||||
gapx := Round(View.FrameWidth / 2) + 2;
|
||||
gapy := Round(View.FrameWidth / 2) div 2 + 1;
|
||||
nx := Round((x+gapx) * PDFEscx) + 1;
|
||||
ny := Round((y+gapy) * PDFEscy) + 1;
|
||||
ndx := Round((View.dx-gapx) * PDFEscx);
|
||||
ndy := Round((View.dy-gapy) * PDFEscy);
|
||||
|
||||
PRTLabel := TPRText.Create(PRPanel);
|
||||
PRTLabel := TPRLabel.Create(PRPanel);
|
||||
PRTLabel.Parent := PRPanel;
|
||||
try
|
||||
PRTLabel.Text := Text;
|
||||
PRTLabel.Caption := Text;
|
||||
PRTLabel.Left := nx;
|
||||
PRTLabel.Top := ny;
|
||||
PRTLabel.Width := ndx;
|
||||
PRTLabel.Height := ndy;
|
||||
if View is TfrMemoView then
|
||||
begin
|
||||
PRTLabel.Alignment := TfrMemoView_(View).Alignment;
|
||||
if Pos('Arial', TfrMemoView_(View).Font.Name) > 0 then
|
||||
PRTLabel.FontName := fnArial
|
||||
else if Pos('Courier', TfrMemoView_(View).Font.Name) > 0 then
|
||||
@ -475,6 +479,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
initialization
|
||||
frRegisterExportFilter(TfrTNPDFExportFilter, 'Adobe Acrobat PDF ' + ' (*.pdf)',
|
||||
'*.pdf');
|
||||
|
@ -3109,8 +3109,8 @@ var
|
||||
if not Exporting then
|
||||
Canvas.TextRect(DR, CurX, CurY, St)
|
||||
else
|
||||
CurReport.InternalOnExportText(curx, cury, St, Self);
|
||||
|
||||
CurReport.InternalOnExportText(X, CurY, St, Self);
|
||||
|
||||
Inc(CurStrNo);
|
||||
Result := False;
|
||||
end
|
||||
@ -3162,7 +3162,7 @@ var
|
||||
if not Exporting then
|
||||
canvas.TextOut(curx,cury,str)
|
||||
else
|
||||
CurReport.InternalOnExportText(curx, cury, str, Self);
|
||||
CurReport.InternalOnExportText(CurX, Y, str, Self);
|
||||
Inc(CurStrNo);
|
||||
curx := curx + th;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user