This is a desktop problem and I think PC. This is also the only time I have drawn text on a Canvas.
Above the Telephone is a T on this image.
The T is in a canvas with a box drawn around it.
The above About Box is on a Mac, but on my PC it is somewhere off to the side.
What could be causing this?
Hi Arthur,
Iâve rtied your code Aand it gave me something wird. The upside down T was off my canvas.
So i have tied to do it in my code and this is what i came up with:
//draw your rectangle
g.DrawingColor = &c000000
g.DrawRectangle( 0, 0, 40, 40 )
//Upside Down T
g.DrawingColor = &c000000
g.FontSize = 25
g.Rotate(3.14159)
g.DrawText(âTâ, -26, -11)
the -26 and the -11 are the mirrored X and Y axes because your T needs to be
upside down.
Hope it helps.
This message was left on Feedback and I can share as it is marked everyone. The project is on the hyperlink.
Robin Lauryssen-Mitchell
April 19, 2021 - 9:19am UTC
For Aruther,
A lightly modified version of your sample project.
Just to make it a little easier to see what is going on.
Also see the âGraphics and Multimediaâ example project âObj2DTextRotation.xojo_binary_projectâ.
Hi Arthur,
I know that rotation isnât centered as that example shows.I had that problem too. I though you wanted an upside down T.If you want to know what the problem is with the example you let me downloaded, it doesnât recalculate the center of the T to the canvas.
Recalulate the position of the chr T and keep it to the center of the canvas.
i would say it is a bug in the Rotation. it came after update from 2020r21 to 2021r1
put your canvas left,top at 0,0 it looks good.
use a rotate property and a timer and add + 0.0174533 to Rotation
then use invalidate you can follow the T
if your canvas is in the middle of the screen it goes wrong.
Object2D.Rotation
Clockwise rotation, in radians, around the X, Y point. Only set the rotation after you have drawn all your objects.
what ever this means: âOnly set the rotation after you have drawn all your objects.â
me used 2021r1 at windows 10 and it looks not correct in this version.
Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
Dim ss As New TextShape
ss.Value = "T"
ss.FontName = "Arial"
ss.FontSize = 25
ss.X = 0
ss.Y = 0
ss.HorizontalAlignment = TextShape.Alignment.Center
ss.VerticalAlignment = TextShape.Alignment.Center
ss.Rotation = Self.Rotate ' 3.14159
Self.Rotate = Self.Rotate + 0.0174533
g.DrawingColor = Color.Black
g.DrawRectangle( 0.0, 0.0, g.Width, g.Height )
g.DrawingColor = Color.Black
g.DrawObject(ss, g.Width / 2.0, g.Height / 2.0)
Return
End Sub
I donât understand but I need for X and Y -20. If I put an x and y in it works on the PC.
if me set the canvas to the top,left edge of the window it rotates correct.
that does not solve your problem but you can see what happens.
i think the problem came because now we can rotate the graphics too.
there must be any changes in xojo framework.
the math just go wrong.