private void LoadFontCombo() { // Display the fonts in sorted order. var fontNames = new List <string>(); //fontNames.AddRange(Browser.NamesOfFontsThatBrowserCanRender()); var xx = new System.Drawing.Text.InstalledFontCollection(); foreach (FontFamily fam in xx.Families) { fontNames.Add(fam.Name); } fontNames.Sort(); var defaultFont = WritingSystem.GetDefaultFontName(); foreach (var font in fontNames) { _fontCombo.Items.Add(font); if (font == defaultFont) { _fontCombo.SelectedItem = font; } } // Make the font combobox wide enough to display the longest value. int width = _fontCombo.DropDownWidth; using (Graphics g = _fontCombo.CreateGraphics()) { Font font = _fontCombo.Font; int vertScrollBarWidth = (_fontCombo.Items.Count > _fontCombo.MaxDropDownItems) ? SystemInformation.VerticalScrollBarWidth : 0; width = (from string s in _fontCombo.Items select TextRenderer.MeasureText(g, s, font).Width).Concat(new[] { width }).Max() + vertScrollBarWidth; } _fontCombo.DropDownWidth = width; }
public CollectionSettings() { Func <string> getCodeOfDefaultLanguageForNaming = () => Language2.Iso639Code; Language1 = new WritingSystem(1, getCodeOfDefaultLanguageForNaming); Language2 = new WritingSystem(2, getCodeOfDefaultLanguageForNaming); Language3 = new WritingSystem(3, getCodeOfDefaultLanguageForNaming); LanguagesZeroBased = new WritingSystem[3]; this.LanguagesZeroBased[0] = Language1; this.LanguagesZeroBased[1] = Language2; this.LanguagesZeroBased[2] = Language3; CollectionName = "dummy collection"; }