mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-06 05:20:23 +02:00
LazReport, Enable justified alignment on export to pdf using PowerPDF (best results when using PowerPDF 0.9.12), issue #26353
git-svn-id: trunk@47119 -
This commit is contained in:
parent
5feb8a998a
commit
539bec103f
@ -452,6 +452,7 @@ var
|
||||
PRTLabel: TPRLabel;
|
||||
nx, ny, ndx, ndy: Integer;
|
||||
gapx, gapy: integer;
|
||||
memo: TfrMemoView;
|
||||
begin
|
||||
gapx := trunc(View.FrameWidth / 2 + 0.5) + 2;
|
||||
gapy := trunc(View.FrameWidth / 4 + 0.5) + 1;
|
||||
@ -464,28 +465,29 @@ begin
|
||||
PRTLabel.Parent := PRPanel;
|
||||
PRTLabel.Clipping := true;
|
||||
try
|
||||
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
|
||||
PRTLabel.FontName := fnFixedWidth
|
||||
else if Pos('Times', TfrMemoView_(View).Font.Name) > 0 then
|
||||
PRTLabel.FontName := fnTimesRoman;
|
||||
PRTLabel.FontSize := TfrMemoView_(View).Font.Size;
|
||||
PRTLabel.FontBold := fsBold in TfrMemoView_(View).Font.Style;
|
||||
PRTLabel.FontItalic := fsItalic in TfrMemoView_(View).Font.Style;
|
||||
PRTLabel.FontColor := TfrMemoView_(View).Font.Color;
|
||||
PRTLabel.FontUnderline := fsUnderline in TfrMemoView_(View).Font.Style;
|
||||
PRTLabel.Angle:= (View as TfrMemoView).Angle;
|
||||
end;
|
||||
|
||||
PRTLabel.Caption := Text;
|
||||
PRTLabel.Left := nx;
|
||||
PRTLabel.Top := ny;
|
||||
PRTLabel.Width := ndx;
|
||||
PRTLabel.Height := ndy;
|
||||
if View is TfrMemoView then
|
||||
begin
|
||||
memo := View as TfrMemoView;
|
||||
PRTLabel.Alignment := memo.Alignment;
|
||||
if Pos('Arial', memo.Font.Name) > 0 then
|
||||
PRTLabel.FontName := fnArial
|
||||
else if Pos('Courier', memo.Font.Name) > 0 then
|
||||
PRTLabel.FontName := fnFixedWidth
|
||||
else if Pos('Times', memo.Font.Name) > 0 then
|
||||
PRTLabel.FontName := fnTimesRoman;
|
||||
PRTLabel.FontSize := memo.Font.Size;
|
||||
PRTLabel.FontBold := fsBold in memo.Font.Style;
|
||||
PRTLabel.FontItalic := fsItalic in memo.Font.Style;
|
||||
PRTLabel.FontColor := memo.Font.Color;
|
||||
PRTLabel.FontUnderline := fsUnderline in memo.Font.Style;
|
||||
PRTLabel.Angle:= memo.Angle;
|
||||
PRTLabel.AlignJustified := memo.Justify and not memo.LastLine;
|
||||
end;
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
@ -16,7 +16,7 @@ interface
|
||||
|
||||
uses
|
||||
SysUtils, Math, {$IFDEF UNIX}CLocale,{$ENDIF} Classes, MaskUtils, Controls, FileUtil,
|
||||
Forms, Dialogs, Menus, Variants, DB, Graphics, Printers, osPrinters,
|
||||
Forms, Dialogs, Menus, Variants, DB, Graphics, Printers, osPrinters, LazUTF8,
|
||||
DOM, XMLWrite, XMLRead, XMLConf, LCLType, LCLIntf, TypInfo, LCLProc, LR_View, LR_Pars,
|
||||
LR_Intrp, LR_DSet, LR_DBSet, LR_DBRel, LR_Const, LMessages, DbCtrls, LazUtf8Classes;
|
||||
|
||||
@ -468,6 +468,7 @@ type
|
||||
Highlight: TfrHighlightAttr;
|
||||
HighlightStr: String;
|
||||
LineSpacing, CharacterSpacing: Integer;
|
||||
LastLine: boolean; // are we painting/exporting the last line?
|
||||
|
||||
constructor Create(AOwnerPage:TfrPage); override;
|
||||
destructor Destroy; override;
|
||||
@ -2100,12 +2101,7 @@ begin
|
||||
CEnd := Length(Arr)-1;
|
||||
if Trimmed then
|
||||
begin
|
||||
s := Trim(Text);
|
||||
if Arr[Cini].Space then
|
||||
begin
|
||||
Inc(Cini);
|
||||
Dec(SpcCount);
|
||||
end;
|
||||
s := UTF8Trim(Text, [u8tKeepStart]);
|
||||
if Arr[CEnd].Space then
|
||||
begin
|
||||
Dec(CEnd);
|
||||
@ -3788,7 +3784,6 @@ var
|
||||
n, {nw, w, }curx, lasty: Integer;
|
||||
lastyf: Double;
|
||||
Ts: TTextStyle;
|
||||
ParaEnd: boolean;
|
||||
begin
|
||||
lastyf := curyf + thf - LineSpc - 1;
|
||||
lastY := Round(lastyf);
|
||||
@ -3801,14 +3796,14 @@ var
|
||||
begin
|
||||
n := Length(St);
|
||||
//w := Ord(St[n - 1]) * 256 + Ord(St[n]);
|
||||
ParaEnd := true;
|
||||
LastLine := true;
|
||||
SetLength(St, n - 2);
|
||||
if Length(St) > 0 then
|
||||
begin
|
||||
if St[Length(St)] = #1 then
|
||||
SetLength(St, Length(St) - 1)
|
||||
else
|
||||
ParaEnd := false;
|
||||
LastLine := false;
|
||||
end;
|
||||
|
||||
// handle any alignment with same code
|
||||
@ -3848,7 +3843,7 @@ var
|
||||
|
||||
if not Exporting then
|
||||
begin
|
||||
if Justify and not ParaEnd then
|
||||
if Justify and not LastLine then
|
||||
CanvasTextRectJustify(Canvas, DR, x+gapx, x+dx-1-gapx, round(CurYf), St, true)
|
||||
else
|
||||
Canvas.TextRect(DR, CurX, round(curYf), St);
|
||||
|
Loading…
Reference in New Issue
Block a user