tags:

views:

260

answers:

1

drawPosText(char[] text, int index, int count, float[] pos, Paint paint) Draw the text in the array, with each character's origin specified by the pos array.

Does anyone know where exactly does drawPosText consider the "origin" to be, since you are specifying "origin" as coordinate pairs; i.e., is it bottom-left of character, center, what?

Also how does drawPosText calculate character height when it draws?

+1  A: 

Ah, I spent a chunk of yesterday playing with centering some text!

If you're in left alignment, the text origin is the bottom left corner. If you're in center alignment, the text is centered horizontally and the origin is bottom center.

You can get the height of the text with

Math.abs(p.ascent()) + p.descent()

where p is your Paint.

kc
Will have to try this out, thanks!
vladikoff