mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 06:52:35 +01:00
Fixed bug regarding double line italic in format "iTunes Timed Text" - thx Ajax :)
This commit is contained in:
parent
e632f41106
commit
c7b8f18a89
@ -213,6 +213,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
|
||||
bool first = true;
|
||||
bool italicOn = false;
|
||||
foreach (string line in text.SplitToLines())
|
||||
{
|
||||
if (!first)
|
||||
@ -240,7 +241,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
attr.InnerText = "italic";
|
||||
currentStyle.Attributes.Append(attr);
|
||||
skipCount = 2;
|
||||
}
|
||||
italicOn = true;
|
||||
}
|
||||
else if (line.Substring(i).StartsWith("<b>", StringComparison.Ordinal))
|
||||
{
|
||||
currentStyle = xml.CreateNode(XmlNodeType.Element, "span", null);
|
||||
@ -289,9 +291,19 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
skipCount = 6;
|
||||
else
|
||||
skipCount = 3;
|
||||
italicOn = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == 0 && italicOn && !(line.Substring(i).StartsWith("<i>", StringComparison.Ordinal)))
|
||||
{
|
||||
styles.Push(currentStyle);
|
||||
currentStyle = xml.CreateNode(XmlNodeType.Element, "span", null);
|
||||
paragraph.AppendChild(currentStyle);
|
||||
XmlAttribute attr = xml.CreateAttribute("tts:fontStyle", "http://www.w3.org/ns/10/ttml#style");
|
||||
attr.InnerText = "italic";
|
||||
currentStyle.Attributes.Append(attr);
|
||||
}
|
||||
currentStyle.InnerText = currentStyle.InnerText + line[i];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user