Skip to content

Commit

Permalink
SubtitleParse: ass parse not truncate style fontname
Browse files Browse the repository at this point in the history
  • Loading branch information
MIRIMIRIM committed May 9, 2024
1 parent 9e66fed commit 8613f1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SubtitleParse/src/AssTypes/AssStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public void Read(ReadOnlySpan<char> 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}");
Expand Down Expand Up @@ -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?
Expand Down

0 comments on commit 8613f1a

Please sign in to comment.