Android examples for android.graphics:Font
get Font Height Metrics
import android.graphics.Paint; import android.graphics.Paint; import android.util.FloatMath; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.regex.Pattern; public class Main{ public static int getFontHeight(float fontSize) { Paint m_paint = new Paint(); m_paint.setTextSize(fontSize);//www. ja va 2 s.co m FontMetrics fm = m_paint.getFontMetrics(); return (int) FloatMath.ceil(fm.descent - fm.top) + 2; } }