A
A
Artem2013-07-30 19:16:15
Android
Artem, 2013-07-30 19:16:15

What units are used in Paint.getTextBounds() and Canvas.drawText()?

I draw text with Canvas.drawText(). In calculating the text coordinates, I use the data obtained using Paint.getTextBounds(). The issue is that Paint.getTextBounds() returns an int while Canvas.drawText() works with a float. There is a suspicion that these are different units of measurement and they need to be brought to the same. Question: what units does Canvas.drawText() use, and what units does Paint.getTextBounds() use?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alcsan, 2013-08-04
@bartwell

Both methods use a common unit of measure.
This link clearly shows the use of both methods on the same canvas - http://stackoverflow.com/a/10853390/1219241

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question