If I want to use DrawText to draw some text on the canvas, but I want the text to end at the center of the screen, how can I do that? I tried setting the x parameter in DrawText to the middle of the screen, and then right aligning inside of the SKPaint definition, but it goes to the right side of the middle, instead of the left.
I feel like this should be fairly simple, but it's not working for me. Help would be appreciated.
appending my question with this code that I'm using to attempt to do what I want ...
SKPaint paint = new SKPaint
{
Color = SKColors.Blue,
TextSize = 30,
TextAlign = SKTextAlign.Right
};
string text = "text";
// rect has the dimensions of the view
var xText = rect.Width / 2;
canvas.DrawText(text, (float)xText, 0, paint);
... Previously to this I was doing a paint.MeasureText(text) but realized to right align would be impossible to do accurately, consistently.