List of usage examples for android.text TextPaint getFontMetrics
public FontMetrics getFontMetrics()
From source file:Main.java
public static float getDesiredHeight(TextPaint paint) { FontMetrics fm = paint.getFontMetrics(); return (float) Math.ceil(fm.descent - fm.ascent); }
From source file:Main.java
public static int getDanmuHeight(TextPaint textPaint) { Paint.FontMetrics fontMetrics = textPaint.getFontMetrics(); return (int) (fontMetrics.bottom - fontMetrics.top + .5f); }
From source file:Main.java
public static int getFontHeight(Context context, float fontSize) { TextPaint paint = new TextPaint(); setTextSize(context, paint, fontSize); FontMetrics fm = paint.getFontMetrics(); return (int) Math.ceil(fm.descent - fm.ascent); }