public void MeasureText(CGContext c, Font f) { // Console.WriteLine ("MEASURE {0}", f); c.SetTextDrawingMode (CGTextDrawingMode.Invisible); c.TextPosition = new PointF(0, 0); c.ShowText ("MM"); var mmWidth = c.TextPosition.X; _height = f.Size - 5; Widths = new float[0x80]; for (var i = ' '; i < 127; i++) { var s = "M" + ((char)i).ToString() + "M"; c.TextPosition = new PointF(0, 0); c.ShowText (s); var sz = c.TextPosition.X - mmWidth; if (sz < 0.1f) { Widths = null; return; } Widths[i] = sz; } c.SetTextDrawingMode (CGTextDrawingMode.Fill); }