From f3efda827a7736be2bb76d11d4ccfe87a122def1 Mon Sep 17 00:00:00 2001 From: niksedk Date: Wed, 18 Sep 2013 19:20:28 +0000 Subject: [PATCH] Fix in new format git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2101 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Logic/SubtitleFormats/Titra.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Logic/SubtitleFormats/Titra.cs b/src/Logic/SubtitleFormats/Titra.cs index ae046b432..8d73a7abd 100644 --- a/src/Logic/SubtitleFormats/Titra.cs +++ b/src/Logic/SubtitleFormats/Titra.cs @@ -33,6 +33,11 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats return subtitle.Paragraphs.Count > _errorCount; } + private int GetMaxCharsForDuration(double durationSeconds) + { + return (int)Math.Round(15.7 * durationSeconds); + } + public override string ToText(Subtitle subtitle, string title) { var sb = new StringBuilder(); @@ -58,7 +63,7 @@ ATTENTION : Pas plus de 40 caractères PAR LIGNE { index++; string text = Utilities.RemoveHtmlTags(p.Text); - sb.AppendLine(string.Format("* {0} :\t{1}\t{2}\t{3}{4}{5}", index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), text.Length + "c", Environment.NewLine, text)); + sb.AppendLine(string.Format("* {0} :\t{1}\t{2}\t{3}{4}{5}", index, EncodeTimeCode(p.StartTime), EncodeTimeCode(p.EndTime), GetMaxCharsForDuration(p.Duration.TotalSeconds) + "c", Environment.NewLine, text)); sb.AppendLine(); if (!text.Contains(Environment.NewLine)) sb.AppendLine();