Tryin to fix Issue 194 - font crash

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2355 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2014-01-08 15:13:48 +00:00
parent 5cc75a9860
commit 51551815a4
2 changed files with 12 additions and 6 deletions

View File

@ -2128,9 +2128,12 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
foreach (var x in FontFamily.Families)
{
comboBoxSubtitleFont.Items.Add(x.Name);
if (string.Compare(x.Name, _subtitleFontName, true) == 0)
comboBoxSubtitleFont.SelectedIndex = comboBoxSubtitleFont.Items.Count - 1;
if (x.IsStyleAvailable(FontStyle.Regular) || x.IsStyleAvailable(FontStyle.Bold))
{
comboBoxSubtitleFont.Items.Add(x.Name);
if (string.Compare(x.Name, _subtitleFontName, true) == 0)
comboBoxSubtitleFont.SelectedIndex = comboBoxSubtitleFont.Items.Count - 1;
}
}
if (comboBoxSubtitleFont.SelectedIndex == -1)
comboBoxSubtitleFont.SelectedIndex = 0; // take first font if default font not found (e.g. linux)

View File

@ -141,9 +141,12 @@ namespace Nikse.SubtitleEdit.Forms
foreach (var x in System.Drawing.FontFamily.Families)
{
comboBoxSubtitleFont.Items.Add(x.Name);
if (string.Compare(x.Name, gs.SubtitleFontName, true) == 0)
comboBoxSubtitleFont.SelectedIndex = comboBoxSubtitleFont.Items.Count - 1;
if (x.IsStyleAvailable(FontStyle.Regular) && x.IsStyleAvailable(FontStyle.Bold))
{
comboBoxSubtitleFont.Items.Add(x.Name);
if (string.Compare(x.Name, gs.SubtitleFontName, true) == 0)
comboBoxSubtitleFont.SelectedIndex = comboBoxSubtitleFont.Items.Count - 1;
}
}
WordListSettings wordListSettings = Configuration.Settings.WordLists;