Text drawing settings

Note that you can use TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, size, getResources().getDisplayMetrics()) to convert from SP or DP to pixels.

Measuring text

String text = "Hello world!";
Rect bounds = new Rect();
paint.getTextBounds(text, 0, text.length(), bounds);

There are other methods for measuring, however these three should fit most purposes.