mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 14:32:35 +01:00
parent
4574db1428
commit
c6761cc77f
@ -1,6 +1,7 @@
|
||||
using Nikse.SubtitleEdit.Core.SubtitleFormats;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Core
|
||||
@ -9,7 +10,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string FontName { get; set; }
|
||||
public int FontSize { get; set; }
|
||||
public float FontSize { get; set; }
|
||||
public bool Italic { get; set; }
|
||||
public bool Bold { get; set; }
|
||||
public bool Underline { get; set; }
|
||||
@ -31,7 +32,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
public SsaStyle()
|
||||
{
|
||||
FontName = Configuration.Settings.SubtitleSettings.SsaFontName;
|
||||
FontSize = (int)Configuration.Settings.SubtitleSettings.SsaFontSize;
|
||||
FontSize = (float)Configuration.Settings.SubtitleSettings.SsaFontSize;
|
||||
Primary = Color.FromArgb(Configuration.Settings.SubtitleSettings.SsaFontColorArgb);
|
||||
Secondary = Color.Yellow;
|
||||
Outline = Color.Black;
|
||||
@ -99,7 +100,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
else if (f == "fontsize")
|
||||
{
|
||||
sb.Append(FontSize);
|
||||
sb.Append(FontSize.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (f == "primarycolour")
|
||||
{
|
||||
@ -206,7 +207,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
else if (f == "fontsize")
|
||||
{
|
||||
sb.Append(FontSize);
|
||||
sb.Append(FontSize.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (f == "primarycolour")
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
var ssa = Configuration.Settings.SubtitleSettings;
|
||||
return "Style: Default," + ssa.SsaFontName + "," +
|
||||
(int)ssa.SsaFontSize + "," +
|
||||
ssa.SsaFontSize.ToString(CultureInfo.InvariantCulture) + "," +
|
||||
GetSsaColorString(Color.FromArgb(ssa.SsaFontColorArgb)) + "," +
|
||||
"&H0300FFFF,&H00000000,&H02000000," + boldStyle + ",0,0,0,100,100,0,0," + borderStyle + "," + ssa.SsaOutline.ToString(CultureInfo.InvariantCulture) + "," +
|
||||
Configuration.Settings.SubtitleSettings.SsaShadow.ToString(CultureInfo.InvariantCulture) + ",2," + ssa.SsaMarginLeft + "," + ssa.SsaMarginRight + "," + ssa.SsaMarginTopBottom + ",1";
|
||||
@ -403,8 +403,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"
|
||||
fontSize = node.Attributes["tts:fontSize"].Value.Replace("px", string.Empty).Replace("em", string.Empty);
|
||||
}
|
||||
|
||||
int fSize;
|
||||
if (!int.TryParse(fontSize, out fSize))
|
||||
if (!float.TryParse(fontSize, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var fSize))
|
||||
{
|
||||
fSize = 20;
|
||||
}
|
||||
@ -551,7 +550,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"
|
||||
fontSize = node.Attributes["tts:fontSize"].Value.Replace("px", string.Empty).Replace("em", string.Empty);
|
||||
}
|
||||
|
||||
if (!int.TryParse(fontSize, out var fSize))
|
||||
if (!float.TryParse(fontSize, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var fSize))
|
||||
{
|
||||
fSize = 20;
|
||||
}
|
||||
@ -824,7 +823,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"
|
||||
string fontSize = text.Substring(start + 4, end - (start + 4));
|
||||
string extraTags = string.Empty;
|
||||
CheckAndAddSubTags(ref fontSize, ref extraTags, out var unknownTags, out italic);
|
||||
if (Utilities.IsInteger(fontSize))
|
||||
if (float.TryParse(fontSize, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out _))
|
||||
{
|
||||
text = text.Remove(start, end - start + 1);
|
||||
if (italic)
|
||||
@ -1747,7 +1746,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"
|
||||
}
|
||||
else if (i == fontsizeIndex)
|
||||
{
|
||||
if (!int.TryParse(f, out _) || f.StartsWith('-'))
|
||||
if (!float.TryParse(f, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture , out _) || f.StartsWith('-'))
|
||||
{
|
||||
sb.AppendLine("'Fontsize' incorrect: " + rawLine);
|
||||
sb.AppendLine();
|
||||
@ -2048,9 +2047,9 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"
|
||||
}
|
||||
else if (i == fontsizeIndex)
|
||||
{
|
||||
if (int.TryParse(f, out var number))
|
||||
if (float.TryParse(f, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var fOut))
|
||||
{
|
||||
style.FontSize = number;
|
||||
style.FontSize = fOut;
|
||||
}
|
||||
}
|
||||
else if (i == primaryColourIndex)
|
||||
|
@ -765,6 +765,7 @@
|
||||
//
|
||||
// numericUpDownFontSize
|
||||
//
|
||||
this.numericUpDownFontSize.DecimalPlaces = 1;
|
||||
this.numericUpDownFontSize.Location = new System.Drawing.Point(100, 44);
|
||||
this.numericUpDownFontSize.Maximum = new decimal(new int[] {
|
||||
200,
|
||||
|
@ -324,7 +324,7 @@ namespace Nikse.SubtitleEdit.Forms.Styles
|
||||
var subItem = new ListViewItem.ListViewSubItem(item, ssaStyle.FontName);
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
subItem = new ListViewItem.ListViewSubItem(item, ssaStyle.FontSize.ToString());
|
||||
subItem = new ListViewItem.ListViewSubItem(item, ssaStyle.FontSize.ToString(CultureInfo.InvariantCulture));
|
||||
item.SubItems.Add(subItem);
|
||||
|
||||
int count = 0;
|
||||
@ -548,9 +548,9 @@ namespace Nikse.SubtitleEdit.Forms.Styles
|
||||
checkBoxFontBold.Checked = style.Bold;
|
||||
checkBoxFontUnderline.Checked = style.Underline;
|
||||
|
||||
if (style.FontSize > 0 && style.FontSize <= numericUpDownFontSize.Maximum)
|
||||
if (style.FontSize > 0 && style.FontSize <= (float)numericUpDownFontSize.Maximum)
|
||||
{
|
||||
numericUpDownFontSize.Value = style.FontSize;
|
||||
numericUpDownFontSize.Value = (decimal)style.FontSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -677,6 +677,7 @@
|
||||
//
|
||||
// numericUpDownFontSize
|
||||
//
|
||||
this.numericUpDownFontSize.DecimalPlaces = 1;
|
||||
this.numericUpDownFontSize.Location = new System.Drawing.Point(100, 44);
|
||||
this.numericUpDownFontSize.Maximum = new decimal(new int[] {
|
||||
200,
|
||||
|
@ -886,9 +886,9 @@ namespace Nikse.SubtitleEdit.Forms.Styles
|
||||
checkBoxFontBold.Checked = style.Bold;
|
||||
checkBoxFontUnderline.Checked = style.Underline;
|
||||
|
||||
if (style.FontSize > 0 && style.FontSize <= numericUpDownFontSize.Maximum)
|
||||
if (style.FontSize > 0 && style.FontSize <= (float) numericUpDownFontSize.Maximum)
|
||||
{
|
||||
numericUpDownFontSize.Value = style.FontSize;
|
||||
numericUpDownFontSize.Value = (decimal) style.FontSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user