Package com.androidplot.util
Class FontUtils
-
- All Implemented Interfaces:
public class FontUtils
-
-
Constructor Summary
Constructors Constructor Description FontUtils()
-
Method Summary
Modifier and Type Method Description static floatgetFontHeight(@NonNull() Paint paint)Determines the height of the tallest character that can be drawn by paint. static RectgetPackedStringDimensions(@NonNull() String text, @NonNull() Paint paint)Get the smallest rect that ecompasses the text to be drawn using paint. static RectgetStringDimensions(@Nullable() String text, @NonNull() Paint paint)Like getPackedStringDimensions except adds extra space to accommodate all characters that can be drawn regardless of whether or not they exist in text. static voiddrawTextVerticallyCentered(@NonNull() Canvas canvas, @NonNull() String text, float cx, float cy, @NonNull() Paint paint)Draws text vertically centered on the specified coordinates -
-
Method Detail
-
getFontHeight
static float getFontHeight(@NonNull() Paint paint)
Determines the height of the tallest character that can be drawn by paint.
-
getPackedStringDimensions
@NonNull() static Rect getPackedStringDimensions(@NonNull() String text, @NonNull() Paint paint)
Get the smallest rect that ecompasses the text to be drawn using paint.
-
getStringDimensions
@Nullable() static Rect getStringDimensions(@Nullable() String text, @NonNull() Paint paint)
Like getPackedStringDimensions except adds extra space to accommodate all characters 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.
-
-
-
-