private void NewFont_Click(object sender, EventArgs e) { QueryNewName qnn = new QueryNewName("Enter a name for this font..."); qnn.ShowDialog(); if (qnn.DialogResult == DialogResult.OK) { font_tracker f = FontEditor.GetFontTracker(qnn.textBox1.Text); this.FontList.DataSource = null; this.FontList.DataSource = fonts; } qnn.Dispose(); }
public static bool Load(XPathNavigator r) { if (r.NodeType == XPathNodeType.Element) { switch (r.Name) { case "Font": //string family = "Lucida Console"; //float size = 12.0f; //GraphicsUnit unit = GraphicsUnit.Pixel; //FontStyle style = FontStyle.Regular; font_tracker ft = null; bool everokay = false; bool okay; for (okay = r.MoveToFirstAttribute(); okay; okay = r.MoveToNextAttribute()) { everokay = true; switch (r.Name) { case "name": ft = FontEditor.GetFontTracker(r.Value); break; case "face": ft.family = r.Value; break; case "size": ft.size = Convert.ToSingle(r.Value); break; case "style": switch (r.Value) { case "Regular": ft.style = FontStyle.Regular; break; case "Bold": ft.style = FontStyle.Bold; break; case "Italic": ft.style = FontStyle.Italic; break; case "Strikeout": ft.style = FontStyle.Strikeout; break; } break; case "units": switch (r.Value) { case "Point": ft.unit = GraphicsUnit.Point; break; case "Display": ft.unit = GraphicsUnit.Display; break; case "Pixel": ft.unit = GraphicsUnit.Pixel; break; default: throw new Exception("Unsupported 'units' saved in font.."); //break; } break; } if (ft == null) { break; } } ft.f = new Font(ft.family, ft.size, ft.style, ft.unit); if (everokay) { r.MoveToParent(); } return(true); } } return(false); }