tags:

views:

16

answers:

1

I'm trying to write a resolution independent Android game. I have some text I want to render onto the canvas and use Paint.setTextSize(...) to set the size of the text. What does the parameter represent? The height of the letters in pixels?

I'm not sure how to set this parameter based on the density or size of the screen either. I generally want my text to fill a certain rectangle of the screen as well as possible (i.e. I want the text to get as close to the full height of the rectangle without the width of the text going outside the rectangle) but I'm not sure how I would do this. I know layouts and textview widgets could help but as it's a game I need a lot of flexibility in the presentation.

A: 

I think this was already answered here: http://stackoverflow.com/questions/3061930/how-to-set-unit-for-paint-settextsize

Sebi
I saw that post but it's unclear. What exactly does the "text size in pixels" mean? The pixel height of the tallest possible letter? The pixel width of the widest possible letter?
LeanBean
Yes, I think it is the height of the tallest letter.
Sebi