Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/UglyToad.PdfPig.Fonts/Type1/Parser/Type1FontParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

/// <summary>
Expand Down Expand Up @@ -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];
Expand All @@ -60,11 +62,9 @@ public static Type1Font Parse(IInputBytes inputBytes, int length1, int length2)
name = "Unknown";
}

var comments = new List<string>();

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<DictionaryToken>();
Expand Down Expand Up @@ -441,7 +441,7 @@ private static ArrayToken GetFontMatrix(IReadOnlyList<DictionaryToken> dictionar
return null;
}

private class PreviousTokenSet
private sealed class PreviousTokenSet
{
private readonly IToken[] tokens = new IToken[3];

Expand Down
Loading