From 8613f1a2bea24cb181393b1e8e06c6198d36c1ea Mon Sep 17 00:00:00 2001 From: MIRIMIRIM <59959583+MIRIMIRIM@users.noreply.github.com> Date: Thu, 9 May 2024 14:30:27 +0800 Subject: [PATCH] SubtitleParse: ass parse not truncate style fontname --- SubtitleParse/src/AssTypes/AssStyle.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SubtitleParse/src/AssTypes/AssStyle.cs b/SubtitleParse/src/AssTypes/AssStyle.cs index 2027626..08efe7e 100644 --- a/SubtitleParse/src/AssTypes/AssStyle.cs +++ b/SubtitleParse/src/AssTypes/AssStyle.cs @@ -54,6 +54,10 @@ public void Read(ReadOnlySpan sp, int lineNumber) Utils.SetProperty(syl, typeof(AssStyle), Formats[i], va[i]); } Collection.Add(syl); + if (syl.Fontname.Length > 31) + { + _logger?.ZLogWarning($"Length ({syl.Fontname.Length}) of style {syl.Name}’s fontname “{syl.Fontname}” exceeds 31 characters, may affect the correct rendering of VSFilter"); + } if (!Names.Add(syl.Name)) { throw new Exception($"Styles: duplicate style {syl.Name}"); @@ -125,7 +129,7 @@ public string Name } public string Fontname { - get => fontname is null ? "Arial" : fontname.Length > 31 ? fontname[..31] : fontname; // GDI max 32, last is null + get => fontname is null ? "Arial" : fontname; // GDI max 32, last is null set => fontname = value; } public float Fontsize { get; set; } // ushort; Is negative and float really correct?