List of usage examples for android.graphics Paint getFontMetricsInt
public int getFontMetricsInt(FontMetricsInt fmi)
From source file:android.support.text.emoji.EmojiSpan.java
@Override public int getSize(@NonNull final Paint paint, final CharSequence text, final int start, final int end, final Paint.FontMetricsInt fm) { paint.getFontMetricsInt(mTmpFontMetrics); final int fontHeight = Math.abs(mTmpFontMetrics.descent - mTmpFontMetrics.ascent); mRatio = fontHeight * 1.0f / mMetadata.getHeight(); mHeight = (short) (mMetadata.getHeight() * mRatio); mWidth = (short) (mMetadata.getWidth() * mRatio); if (fm != null) { fm.ascent = mTmpFontMetrics.ascent; fm.descent = mTmpFontMetrics.descent; fm.top = mTmpFontMetrics.top;/* ww w.j a v a 2 s . com*/ fm.bottom = mTmpFontMetrics.bottom; } return mWidth; }