mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 10:39:20 +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;
|
procedure TfrTNPDFExportFilter.OnText(X, Y: Integer; const Text: string;
|
||||||
View: TfrView);
|
View: TfrView);
|
||||||
var
|
var
|
||||||
PRTLabel: TPRText;
|
PRTLabel: TPRLabel;
|
||||||
nx, ny,
|
nx, ny,
|
||||||
ndx, ndy: Integer;
|
ndx, ndy: Integer;
|
||||||
|
gapx, gapy: integer;
|
||||||
begin
|
begin
|
||||||
nx := Round(x * PDFEscx) + 1;
|
gapx := Round(View.FrameWidth / 2) + 2;
|
||||||
ny := Round(y * PDFEscy) + 1;
|
gapy := Round(View.FrameWidth / 2) div 2 + 1;
|
||||||
ndx := Round(View.dx * PDFEscx);
|
nx := Round((x+gapx) * PDFEscx) + 1;
|
||||||
ndy := Round(View.dy * PDFEscy);
|
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;
|
PRTLabel.Parent := PRPanel;
|
||||||
try
|
try
|
||||||
PRTLabel.Text := Text;
|
PRTLabel.Caption := Text;
|
||||||
PRTLabel.Left := nx;
|
PRTLabel.Left := nx;
|
||||||
PRTLabel.Top := ny;
|
PRTLabel.Top := ny;
|
||||||
PRTLabel.Width := ndx;
|
PRTLabel.Width := ndx;
|
||||||
PRTLabel.Height := ndy;
|
PRTLabel.Height := ndy;
|
||||||
if View is TfrMemoView then
|
if View is TfrMemoView then
|
||||||
begin
|
begin
|
||||||
|
PRTLabel.Alignment := TfrMemoView_(View).Alignment;
|
||||||
if Pos('Arial', TfrMemoView_(View).Font.Name) > 0 then
|
if Pos('Arial', TfrMemoView_(View).Font.Name) > 0 then
|
||||||
PRTLabel.FontName := fnArial
|
PRTLabel.FontName := fnArial
|
||||||
else if Pos('Courier', TfrMemoView_(View).Font.Name) > 0 then
|
else if Pos('Courier', TfrMemoView_(View).Font.Name) > 0 then
|
||||||
@ -475,6 +479,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
frRegisterExportFilter(TfrTNPDFExportFilter, 'Adobe Acrobat PDF ' + ' (*.pdf)',
|
frRegisterExportFilter(TfrTNPDFExportFilter, 'Adobe Acrobat PDF ' + ' (*.pdf)',
|
||||||
'*.pdf');
|
'*.pdf');
|
||||||
|
@ -3109,8 +3109,8 @@ var
|
|||||||
if not Exporting then
|
if not Exporting then
|
||||||
Canvas.TextRect(DR, CurX, CurY, St)
|
Canvas.TextRect(DR, CurX, CurY, St)
|
||||||
else
|
else
|
||||||
CurReport.InternalOnExportText(curx, cury, St, Self);
|
CurReport.InternalOnExportText(X, CurY, St, Self);
|
||||||
|
|
||||||
Inc(CurStrNo);
|
Inc(CurStrNo);
|
||||||
Result := False;
|
Result := False;
|
||||||
end
|
end
|
||||||
@ -3162,7 +3162,7 @@ var
|
|||||||
if not Exporting then
|
if not Exporting then
|
||||||
canvas.TextOut(curx,cury,str)
|
canvas.TextOut(curx,cury,str)
|
||||||
else
|
else
|
||||||
CurReport.InternalOnExportText(curx, cury, str, Self);
|
CurReport.InternalOnExportText(CurX, Y, str, Self);
|
||||||
Inc(CurStrNo);
|
Inc(CurStrNo);
|
||||||
curx := curx + th;
|
curx := curx + th;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user