What you need to know are:
1. The width of the screen
2. The width of your text
3. The number of spaces in your line of text
Subtract the length of the text from the width of the screen. The difference then needs to be divided by the number of spaces you have.
The last figure is then the additional amount you need to add whenever you find a space during the drawing of your text.
I'd calculate the x co-ordinates as floats, so any rounding won't mess up the positioning of your text.
Hope that helps.
1. The width of the screen
2. The width of your text
3. The number of spaces in your line of text
Subtract the length of the text from the width of the screen. The difference then needs to be divided by the number of spaces you have.
The last figure is then the additional amount you need to add whenever you find a space during the drawing of your text.
I'd calculate the x co-ordinates as floats, so any rounding won't mess up the positioning of your text.
Hope that helps.