You've already forked lazarus-ccr
PowerPDF: implements single line text rotation at 90 degrees, from Julio Jiménez Borreguero
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2440 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -401,6 +401,7 @@ type
|
|||||||
FWordwrap: boolean;
|
FWordwrap: boolean;
|
||||||
FLeading: Single;
|
FLeading: Single;
|
||||||
FLines: TStrings;
|
FLines: TStrings;
|
||||||
|
FAngle: integer;
|
||||||
procedure SetLeading(Value: Single);
|
procedure SetLeading(Value: Single);
|
||||||
procedure SetWordwrap(Value: boolean);
|
procedure SetWordwrap(Value: boolean);
|
||||||
procedure SetLines(Value: TStrings);
|
procedure SetLines(Value: TStrings);
|
||||||
@@ -414,6 +415,7 @@ type
|
|||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
property Text: string read GetText write SetText;
|
property Text: string read GetText write SetText;
|
||||||
|
property Angle: integer read Fangle write Fangle;
|
||||||
published
|
published
|
||||||
property Leading: Single read FLeading write SetLeading;
|
property Leading: Single read FLeading write SetLeading;
|
||||||
property Lines: TStrings read GetLines write SetLines;
|
property Lines: TStrings read GetLines write SetLines;
|
||||||
@@ -2021,7 +2023,10 @@ begin
|
|||||||
SetWordSpace(WordSpace);
|
SetWordSpace(WordSpace);
|
||||||
SetLeading(Leading);
|
SetLeading(Leading);
|
||||||
Attribute.FontUnderline:=FontUnderline;
|
Attribute.FontUnderline:=FontUnderline;
|
||||||
|
// Only one line of text rotated for now. It's the begining
|
||||||
|
if Angle=90 then
|
||||||
|
TextOutRotatedUp(Left + FontSize, GetPage.Height- Top, Text)
|
||||||
|
else
|
||||||
with ARect do
|
with ARect do
|
||||||
MultilineTextRect(_PdfRect(Left, GetPage.Height- Top, Right, GetPage.Height- Bottom),
|
MultilineTextRect(_PdfRect(Left, GetPage.Height- Top, Right, GetPage.Height- Bottom),
|
||||||
Text, WordWrap);
|
Text, WordWrap);
|
||||||
|
@@ -483,6 +483,9 @@ type
|
|||||||
property Doc: TPdfDoc read GetDoc;
|
property Doc: TPdfDoc read GetDoc;
|
||||||
property PageWidth: integer read GetPageWidth write SetPageWidth;
|
property PageWidth: integer read GetPageWidth write SetPageWidth;
|
||||||
property PageHeight: integer read GetPageHeight write SetPageHeight;
|
property PageHeight: integer read GetPageHeight write SetPageHeight;
|
||||||
|
|
||||||
|
{* Text rotated up *}
|
||||||
|
procedure TextOutRotatedUp(X, Y: Single; Text: string);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TPdfDictionaryWrapper = class(TPersistent)
|
TPdfDictionaryWrapper = class(TPersistent)
|
||||||
@@ -2259,6 +2262,14 @@ begin
|
|||||||
Index := i + 1;
|
Index := i + 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPdfCanvas.TextOutRotatedUp(X, Y: Single; Text: string);
|
||||||
|
begin
|
||||||
|
BeginText;
|
||||||
|
SetTextMatrix(0, 1, -1, 0, X, Y); // down to up
|
||||||
|
ShowText(Text);
|
||||||
|
EndText;
|
||||||
|
end;
|
||||||
|
|
||||||
// GetDoc
|
// GetDoc
|
||||||
function TPdfCanvas.GetDoc: TPdfDoc;
|
function TPdfCanvas.GetDoc: TPdfDoc;
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user