diff --git a/src/Controls/VideoPlayerContainer.cs b/src/Controls/VideoPlayerContainer.cs
index 81367efc2..4f63f4b91 100644
--- a/src/Controls/VideoPlayerContainer.cs
+++ b/src/Controls/VideoPlayerContainer.cs
@@ -308,20 +308,27 @@ namespace Nikse.SubtitleEdit.Controls
// remove styles for display text (except italic)
string text = RemoveSubStationAlphaFormatting(_subtitleText);
- text = HtmlUtil.RemoveOpenCloseTags(text, HtmlUtil.TagBold, HtmlUtil.TagUnderline);
+ text = text.Replace("", string.Empty);
text = text.Replace("", string.Empty);
+ text = text.Replace("", string.Empty);
// display italic
var sb = new StringBuilder();
int i = 0;
bool isItalic = false;
+ bool isBold = false;
+ bool isUnderline = false;
bool isFontColor = false;
- int italicBegin = 0;
int fontColorBegin = 0;
_subtitleTextBox.Text = string.Empty;
int letterCount = 0;
- var italicLookups = new System.Collections.Generic.Dictionary();
var fontColorLookups = new System.Collections.Generic.Dictionary();
+ var styleLookups = new System.Collections.Generic.Dictionary(text.Length);
+ for (int j = 0; j < text.Length; j++)
+ {
+ styleLookups.Add(j, Configuration.Settings.General.VideoPlayerPreviewFontBold ? FontStyle.Bold : FontStyle.Regular);
+ }
+
Color fontColor = Color.White;
while (i < text.Length)
{
@@ -330,17 +337,49 @@ namespace Nikse.SubtitleEdit.Controls
_subtitleTextBox.AppendText(sb.ToString());
sb = new StringBuilder();
isItalic = true;
- italicBegin = letterCount;
i += 2;
}
else if (text.Substring(i).StartsWith("", StringComparison.OrdinalIgnoreCase) && isItalic)
{
- italicLookups.Add(italicBegin, _subtitleTextBox.Text.Length + sb.ToString().Length - italicBegin);
_subtitleTextBox.AppendText(sb.ToString());
sb = new StringBuilder();
isItalic = false;
i += 3;
}
+ else if (text.Substring(i).StartsWith("", StringComparison.OrdinalIgnoreCase))
+ {
+ if (!Configuration.Settings.General.VideoPlayerPreviewFontBold)
+ {
+ _subtitleTextBox.AppendText(sb.ToString());
+ sb = new StringBuilder();
+ isBold = true;
+ }
+ i += 2;
+ }
+ else if (text.Substring(i).StartsWith("", StringComparison.OrdinalIgnoreCase) && isBold)
+ {
+ if (!Configuration.Settings.General.VideoPlayerPreviewFontBold)
+ {
+ _subtitleTextBox.AppendText(sb.ToString());
+ sb = new StringBuilder();
+ isBold = false;
+ }
+ i += 3;
+ }
+ else if (text.Substring(i).StartsWith("", StringComparison.OrdinalIgnoreCase))
+ {
+ _subtitleTextBox.AppendText(sb.ToString());
+ sb = new StringBuilder();
+ isUnderline = true;
+ i += 2;
+ }
+ else if (text.Substring(i).StartsWith("", StringComparison.OrdinalIgnoreCase) && isUnderline)
+ {
+ _subtitleTextBox.AppendText(sb.ToString());
+ sb = new StringBuilder();
+ isUnderline = false;
+ i += 3;
+ }
else if (text.Substring(i).StartsWith("