Example usage for android.graphics Paint getFontMetrics

List of usage examples for android.graphics Paint getFontMetrics

Introduction

In this page you can find the example usage for android.graphics Paint getFontMetrics.

Prototype

public FontMetrics getFontMetrics() 

Source Link

Document

Allocates a new FontMetrics object, and then calls getFontMetrics(fm) with it, returning the object.

Usage

From source file:Main.java

public static float getFontLeading(Paint paint) {
    FontMetrics fm = paint.getFontMetrics();
    return fm.leading - fm.ascent;
}

From source file:Main.java

public static float getFontHeight(Paint paint) {
    FontMetrics fm = paint.getFontMetrics();
    return fm.descent - fm.ascent;
}

From source file:Main.java

public static int getTextBaseLine(Paint paint) {
    Paint.FontMetrics fm = paint.getFontMetrics();
    return (int) Math.abs(fm.bottom);
}

From source file:Main.java

public static int getTextFullHeight(Paint paint) {
    Paint.FontMetrics fm = paint.getFontMetrics();
    return (int) Math.ceil(fm.bottom - fm.top);
}

From source file:Main.java

public static int getTextHeight(Paint paint) {
    Paint.FontMetrics fm = paint.getFontMetrics();
    return (int) Math.ceil(fm.descent - fm.ascent);
}

From source file:Main.java

public static float getTextHeight(Paint paint) {
    Paint.FontMetrics fm = paint.getFontMetrics();
    return (float) (Math.ceil(fm.descent - fm.ascent) + 2f);
}

From source file:Main.java

public static float getFontHeight(Paint paint) {
    Paint.FontMetrics fm = paint.getFontMetrics();
    return fm.descent - fm.ascent;
}

From source file:Main.java

public static float getLineSpacing(Paint paint) {
    Paint.FontMetrics metrics = paint.getFontMetrics();
    return metrics.ascent - metrics.top + metrics.bottom;
}

From source file:Main.java

public static float getLineHeight(Paint paint) {
    Paint.FontMetrics metrics = paint.getFontMetrics();
    return metrics.descent - metrics.ascent;
}

From source file:Main.java

public static float getTextLeading(Paint paint) {
    FontMetrics fm = paint.getFontMetrics();
    return fm.leading - fm.ascent;
}