kTextAlignment.right is not working as expected

Hello everyone!
I'm having a issue when trying to draw text with right Alignment

What I expect is to write my text in the top-right corner by using the x=400 y=10 coordinates on a fullscreen image.

Here there are some examples (the blue line is the reference from where the background image starts (I'm drawing the text over another image).

This is what I expect:

This is what I'm getting:

local back = self.imgtable:getImage(3)
		gfx.lockFocus(back)
		gfx.setFont(self.font)
		
		gfx.drawTextAligned("123456789", 30, 0, kTextAlignment.right)
		
		gfx.unlockFocus()
		self:setImage(back)

This is what happens when I use kTextAlignment.left
(instead of right. It works properly but it is not what I need)

local back = self.imgtable:getImage(3)
		gfx.lockFocus(back)
		gfx.setFont(self.font)

		gfx.drawTextAligned("123456789", 30, 0, kTextAlignment.left)
		
		gfx.unlockFocus()
		self:setImage(back)

Platform:
I'm devloping with Lua SDK 1.12.2 for Windows.

1 Like

Can you reproduce with a minimal example?

Ok, I was trying to reproduce it in a new project and I realized that I had an error in the image I was using as background (the size didn't match so I was placing the text wrongly).

So... it is embarrasing, this is not a SDK issue, but a bug in my code.
Should I delete this thread?

Thank you very much for your interest and patience!

1 Like

Don't worry! There are lessons in everything so feel free to leave this thread intact.