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:
jesusr
2012-05-24 19:19:17 +00:00
parent 3a3e49b01c
commit 03ba6287a3
2 changed files with 17 additions and 1 deletions

View File

@@ -401,6 +401,7 @@ type
FWordwrap: boolean;
FLeading: Single;
FLines: TStrings;
FAngle: integer;
procedure SetLeading(Value: Single);
procedure SetWordwrap(Value: boolean);
procedure SetLines(Value: TStrings);
@@ -414,6 +415,7 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Text: string read GetText write SetText;
property Angle: integer read Fangle write Fangle;
published
property Leading: Single read FLeading write SetLeading;
property Lines: TStrings read GetLines write SetLines;
@@ -2021,7 +2023,10 @@ begin
SetWordSpace(WordSpace);
SetLeading(Leading);
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
MultilineTextRect(_PdfRect(Left, GetPage.Height- Top, Right, GetPage.Height- Bottom),
Text, WordWrap);

View File

@@ -483,6 +483,9 @@ type
property Doc: TPdfDoc read GetDoc;
property PageWidth: integer read GetPageWidth write SetPageWidth;
property PageHeight: integer read GetPageHeight write SetPageHeight;
{* Text rotated up *}
procedure TextOutRotatedUp(X, Y: Single; Text: string);
end;
TPdfDictionaryWrapper = class(TPersistent)
@@ -2259,6 +2262,14 @@ begin
Index := i + 1;
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
function TPdfCanvas.GetDoc: TPdfDoc;
begin