public EmojiSpan(EmojiDrawable d, int verticalAlignment, int s, Paint.FontMetricsInt original) : base(d) { fontMetrics = original; if (original != null) { size = System.Math.Abs(fontMetrics.Descent) + System.Math.Abs(fontMetrics.Ascent); if (size == 0) { size = AndroidUtilities.dp(20); } } }
public override int GetSize(Paint paint, ICharSequence text, int start, int end, Paint.FontMetricsInt fm) { if (fm == null) { fm = new Paint.FontMetricsInt(); } if (fontMetrics == null) { int sz = base.GetSize(paint, text, start, end, fm); int offset = AndroidUtilities.dp(8); int w = AndroidUtilities.dp(10); fm.Top = -w - offset; fm.Bottom = w - offset; fm.Ascent = -w - offset; fm.Leading = 0; fm.Descent = w - offset; return(sz); } else { if (fm != null) { fm.Ascent = fontMetrics.Ascent; fm.Descent = fontMetrics.Descent; fm.Top = fontMetrics.Top; fm.Bottom = fontMetrics.Bottom; } if (Drawable != null) { Drawable.SetBounds(0, 0, size, size); } return(size); } }