Center Justify with drawString in a Canvas?

There’s no TextAlign for DrawString, so does anyone have any clever ideas on how to fudge it?
DrawString positions from top, and left.

Is there any way to determine how long in pixels the string would draw as so I could do the math to figure out where to place it so it ends up being centered?

Does anyone have any better ideas?

Is there an official method I missed? o.O

graphics.StringWidth
graphics.TextHeight
graphics.TextAscent

Thank you so much. I can’t believe I overlooked that :slight_smile:

Tim, you might also want to have a look at this thread…

https://forum.xojo.com/9575-get-the-rectangle-of-a-stringshape

Using the StringShape object in combination with the graphics.DrawObject() method is an easy way to rotate and position text on a canvas.