You are not logged in.
Pages: 1
Hello,
I am trying to render rotated text, but SetTextMatrix does not seem to have any effect.
I have been trying with variations of the following code, with SetTextMatrix inside or outside BeginText, there was no effect... anything obvious I missed ?
var a := rotation*(PI/180);
var c := Cos(a);
var s := Sin(a);
pdf.Canvas.SetTextMatrix(c, s, -s, c, 0, 0);
pdf.Canvas.BeginText;
if centered then begin
X := X + pdf.DefaultPageWidth div 2;
Y := Y + pdf.DefaultPageHeight div 2;
end;
pdf.Canvas.TextRect(PdfRect(X, Y, X+1, Y+1), text, paCenter, False);
// pdf.Canvas.TextOut(X, Y, text); // tried this as well, no better
pdf.Canvas.EndText;
Offline
With this changes, it works!
var a := rotation*(PI/180);
var c := Cos(a);
var s := Sin(a);
pdf.Canvas.BeginText;
if centered then begin
X := X + pdf.DefaultPageWidth div 2;
Y := Y + pdf.DefaultPageHeight div 2;
end;
pdf.Canvas.SetTextMatrix(c, s, -s, c, X, Y);
pdf.Canvas.ShowText(text);
pdf.Canvas.EndText;
BeginText BEFORE SetTextMatrix
and ShowText for write the Text
Offline
Pages: 1