mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
DCSubtitle (DCinema/DCI) format now allows/remembers custom font size - thx Michal
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@691 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
61e6c47fe5
commit
88e812091b
@ -98,11 +98,12 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
|||||||
" <IssueDate>" + date + "</IssueDate>" + Environment.NewLine +
|
" <IssueDate>" + date + "</IssueDate>" + Environment.NewLine +
|
||||||
" <Language>" + languageEnglishName + "</Language>" + Environment.NewLine +
|
" <Language>" + languageEnglishName + "</Language>" + Environment.NewLine +
|
||||||
" <LoadFont URI=\"Arial.ttf\" Id=\"Font1\"/>" + Environment.NewLine +
|
" <LoadFont URI=\"Arial.ttf\" Id=\"Font1\"/>" + Environment.NewLine +
|
||||||
" <Font Color=\"FFFFFFFF\" Effect=\"outline\" EffectColor=\"FF000000\" Italic=\"no\" Underlined=\"no\" Script=\"normal\" Size=\"52\">" + Environment.NewLine +
|
" <Font Color=\"FFFFFFFF\" Effect=\"outline\" EffectColor=\"FF000000\" Italic=\"no\" Underlined=\"no\" Script=\"normal\" Size=\"42\">" + Environment.NewLine +
|
||||||
" </Font>" + Environment.NewLine +
|
" </Font>" + Environment.NewLine +
|
||||||
"</DCSubtitle>";
|
"</DCSubtitle>";
|
||||||
|
|
||||||
string loadedFontId = "Font1";
|
string loadedFontId = "Font1";
|
||||||
|
int fontSize = 42;
|
||||||
|
|
||||||
XmlDocument xml = new XmlDocument();
|
XmlDocument xml = new XmlDocument();
|
||||||
xml.LoadXml(xmlStructure);
|
xml.LoadXml(xmlStructure);
|
||||||
@ -143,6 +144,20 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
|||||||
loadedFontId = null;
|
loadedFontId = null;
|
||||||
xml.DocumentElement.RemoveChild(xml.DocumentElement.SelectSingleNode("LoadFont"));
|
xml.DocumentElement.RemoveChild(xml.DocumentElement.SelectSingleNode("LoadFont"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
node = xmlHeader.DocumentElement.SelectSingleNode("Font");
|
||||||
|
if (node != null && node.Attributes["Size"] != null)
|
||||||
|
{
|
||||||
|
int temp;
|
||||||
|
if (int.TryParse(node.Attributes["Size"].Value, out temp))
|
||||||
|
{
|
||||||
|
if (temp > 4 && temp < 100)
|
||||||
|
{
|
||||||
|
fontSize = temp;
|
||||||
|
xml.DocumentElement.SelectSingleNode("Font").Attributes["Size"].Value = fontSize.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -188,6 +203,9 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
|||||||
|
|
||||||
string[] lines = p.Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
string[] lines = p.Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||||
int vPos = 1 + lines.Length * 7;
|
int vPos = 1 + lines.Length * 7;
|
||||||
|
int vPosFactor = (int)Math.Round(fontSize / 7.4);
|
||||||
|
vPos = (lines.Length * vPosFactor) - vPosFactor + 8; // always bottom margin 8
|
||||||
|
|
||||||
bool isItalic = false;
|
bool isItalic = false;
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
@ -274,7 +292,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
|||||||
textNode.InnerXml = html.ToString();
|
textNode.InnerXml = html.ToString();
|
||||||
|
|
||||||
subNode.AppendChild(textNode);
|
subNode.AppendChild(textNode);
|
||||||
vPos -= 7;
|
vPos -= vPosFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
mainListFont.AppendChild(subNode);
|
mainListFont.AppendChild(subNode);
|
||||||
|
Loading…
Reference in New Issue
Block a user