diff --git a/src/UglyToad.PdfPig.Fonts/Type1/Parser/Type1FontParser.cs b/src/UglyToad.PdfPig.Fonts/Type1/Parser/Type1FontParser.cs index 606725be1..bd64e98d9 100644 --- a/src/UglyToad.PdfPig.Fonts/Type1/Parser/Type1FontParser.cs +++ b/src/UglyToad.PdfPig.Fonts/Type1/Parser/Type1FontParser.cs @@ -18,6 +18,8 @@ public static class Type1FontParser private const int PfbFileIndicator = 0x80; + private static readonly char[] Separators = [' ']; + private static readonly Type1EncryptedPortionParser EncryptedPortionParser = new Type1EncryptedPortionParser(); /// @@ -48,9 +50,9 @@ public static Type1Font Parse(IInputBytes inputBytes, int length1, int length2) { throw new InvalidFontFormatException("The Type1 program did not start with '%!'."); } - + string name; - var parts = comment.Data.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); + var parts = comment.Data.Split(Separators, StringSplitOptions.RemoveEmptyEntries); if (parts.Length == 3) { name = parts[1]; @@ -60,11 +62,9 @@ public static Type1Font Parse(IInputBytes inputBytes, int length1, int length2) name = "Unknown"; } - var comments = new List(); - - while (scanner.MoveNext() && scanner.CurrentToken is CommentToken commentToken) + while (scanner.MoveNext() && scanner.CurrentToken is CommentToken) { - comments.Add(commentToken.Data); + // We ignore comments } var dictionaries = new List(); @@ -441,7 +441,7 @@ private static ArrayToken GetFontMatrix(IReadOnlyList dictionar return null; } - private class PreviousTokenSet + private sealed class PreviousTokenSet { private readonly IToken[] tokens = new IToken[3];