Add more italic support to spt/sptx - thx Peter :)

This commit is contained in:
nikolaj.olsson 2019-01-28 10:07:45 +01:00
parent 88223ef242
commit 720ba172d9
2 changed files with 12 additions and 0 deletions

View File

@ -134,6 +134,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
int textLengthFirstLine = buffer[index + 16 + 20];
int textLengthSecondLine = buffer[index + 16 + 20 + 4];
var allItalic = buffer[index + 16 + 4] == 1;
if (textLengthFirstLine == 0 && textLengthSecondLine == 0)
{
@ -156,6 +157,11 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
p.Text += Environment.NewLine + Encoding.Default.GetString(buffer, index + 16 + 20 + 16 + textLengthFirstLine, textLengthSecondLine);
}
if (allItalic)
{
p.Text = "<i>" + p.Text.Trim() + "</i>";
}
index += 16 + 20 + 16 + textLengthFirstLine + textLengthSecondLine;
return p;
}

View File

@ -78,6 +78,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
if (ok)
{
var allItalic = buffer[index + 16 + 4] == 1;
var length1 = buffer[index + 16 + 20];
var length2 = buffer[index + 16 + 26];
var length = length1;
@ -99,6 +100,11 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
EndTime = GetTimeCode(Encoding.UTF8.GetString(buffer, index + 8, 8)),
Text = FixItalics(text)
};
if (allItalic)
{
p.Text = "<i>" + p.Text.Trim() + "</i>";
}
index += 16;
return p;
}