public Region[] MeasureCharacterRanges(string text, Font font, RectangleF layoutRect, StringFormat stringFormat) { using (var _p = new droid.Paint(this.paint)) using (var _path = new droid.Path()) using (var _fm = _p.GetFontMetrics()) { _p.TextSize = font.Size; _p.SetTypeface(font.FontFamily.Typeface); _p.SetStyle(droid.Paint.Style.Stroke); _p.GetTextPath(text, 0, text.Length, 0, 0, _path); var _rectf = new droid.RectF(); _path.ComputeBounds(_rectf, true); return(new Region[] { new Region(_rectf) }); } }
public Region[] MeasureCharacterRanges(string text, Font font, RectangleF layoutRect, StringFormat stringFormat) { using (var _p = new droid.Paint(this.paint)) using (var _path = new droid.Path()) using (var _fm = _p.GetFontMetrics()) { _p.TextSize = font.Size; _p.SetTypeface(font.FontFamily.Typeface); _p.SetStyle(droid.Paint.Style.Stroke); _p.GetTextPath(text, 0, text.Length, 0, 0, _path); var _rectf = new droid.RectF(); _path.ComputeBounds(_rectf, true); return new Region[] { new Region(_rectf) }; } }