public int GetWidth (string text) { text = text.Replace ("\t", new string (' ', textEditor.Options.TabSize)); defaultLayout.SetText (text); int width, height; defaultLayout.GetPixelSize (out width, out height); return width; }