public float GetTypographicWidth(TFont font, AttributedGlyphRun <TFont, TGlyph> run) { var aString = run.ToNsAttributedString(); using (var ctLine = new CTLine(aString)) return((float)ctLine.GetTypographicBounds()); }
public void DrawGlyphRunWithOffset(AttributedGlyphRun <TFont, TGlyph> run, PointF offset, Color?color) { DebugWriteLine($"Text {run} {offset.X} {offset.Y}"); CgContext.TextPosition = new CGPoint(CgContext.TextPosition.X + offset.X, CgContext.TextPosition.Y + offset.Y); if (color.HasValue) { CgContext.SetFillColor(color.Value.ToCgColor()); } using (var textLine = new CTLine(run.ToNsAttributedString())) textLine.Draw(CgContext); }
public void DrawGlyphRunWithOffset(AttributedGlyphRun <TFont, TGlyph> run, PointF offset, Color?color) { CgContext.TextPosition = new CGPoint (CgContext.TextPosition.X + offset.X, CgContext.TextPosition.Y + offset.Y); if (color.HasValue) { CgContext.SetFillColor(color.GetValueOrDefault().ToCGColor()); } using var textLine = new CTLine(run.ToNsAttributedString()); textLine.Draw(CgContext); }