-
public class FontUtils
-
-
Method Summary
Modifier and Type Method Description static float
getFontHeight(Paint paint)
Determines the height of the tallest character that can be drawn by paint. static Rect
getPackedStringDimensions(String text, Paint paint)
Get the smallest rect that ecompasses the text to be drawn using paint. static Rect
getStringDimensions(String text, Paint paint)
Like getPackedStringDimensions except adds extra space to accommodate allcharacters that can be drawn regardless of whether or not they exist in text.This ensures a more uniform appearance for things that have dynamic text. static void
drawTextVerticallyCentered(Canvas canvas, String text, float cx, float cy, Paint paint)
Draws text vertically centered on the specified coordinates -
-
Method Detail
-
getFontHeight
static float getFontHeight(Paint paint)
Determines the height of the tallest character that can be drawn by paint.
-
getPackedStringDimensions
static Rect getPackedStringDimensions(String text, Paint paint)
Get the smallest rect that ecompasses the text to be drawn using paint.
-
getStringDimensions
static Rect getStringDimensions(String text, Paint paint)
Like getPackedStringDimensions except adds extra space to accommodate allcharacters that can be drawn regardless of whether or not they exist in text.This ensures a more uniform appearance for things that have dynamic text.
-
drawTextVerticallyCentered
static void drawTextVerticallyCentered(Canvas canvas, String text, float cx, float cy, Paint paint)
Draws text vertically centered on the specified coordinates
-
-
-
-