Note that there are some explanatory texts on larger screens.

plurals
  1. POFiremonkey Rotate Text
    primarykey
    data
    text
    <p>I want to draw Text on a canvas. To do the rotation I used the following code from <a href="https://forums.embarcadero.com/thread.jspa?messageID=440010" rel="nofollow">https://forums.embarcadero.com/thread.jspa?messageID=440010</a></p> <pre><code>//bm is a TImage a := 45; c:= bm.Canvas; CurrentM := c.Matrix; a:=-radian(a); m.m11:= cos(a); m.m12:=sin(a); m.m13:=0; m.m21:=-sin(a); m.m22:=cos(a); m.m23:=0; m.m31:=0; m.m32:=0; m.m33:=1; c.setmatrix(M); c.BeginScene; c.filltext(rectf(100,100,5000,5000), 'test rotated string', false,1,[],ttextalign.taLeading,ttextalign.taLeading); c.EndScene; </code></pre> <p>This works fine. I have set my rectangle's right and bottom to 5000 so that I do not have to be worried about my rectangle being to small.</p> <p>The problem is that I now want to change my TextAlignment properties. So to draw text from right to left I had to adjust my rectangle and then draw it in the following way:</p> <pre><code>c.BeginScene; c.filltext(rectf((100 - 5000),100,100,5000), 'test rotated string', false,1,[],ttextalign.taTrailing,ttextalign.taLeading); c.EndScene; </code></pre> <p>So basically I moved the x value of my rectangle's TopLeft and moved it back 5000 (again I am using 5000 to make sure my text fit). I then set the x value of my rectangle's bottom right to where the x value was in my previous example's rectangle's TopLeft. This work fine for a 0 degree rotation, but as soon as I change the degrees I does not draw my text at the correct place. I assume this is because the text will rotate around the rectangle's TopLeft position (which is altered to make the text write from right to left). </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload