Skip to content

Commit

Permalink
remove useless checksum check for truetype font processing
Browse files Browse the repository at this point in the history
  • Loading branch information
EliotJones authored and BobLd committed Sep 29, 2024
1 parent f6566d6 commit eb9a191
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/UglyToad.PdfPig.Fonts/TrueType/Parser/TableParser.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace UglyToad.PdfPig.Fonts.TrueType.Parser
{
using System;
using System.Diagnostics;
using Tables;

internal static class TableParser
Expand All @@ -14,19 +13,7 @@ internal static class TableParser

public static T Parse<T>(TrueTypeHeaderTable table, TrueTypeDataBytes data, TableRegister.Builder register) where T : ITrueTypeTable
{
// checksum https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6.html
uint sum = 0;
var nLongs = (table.Length + 3) / 4;
data.Seek(table.Offset);
while (nLongs-- > 0)
{
sum += (uint)data.ReadSignedInt();
}

if (sum != table.CheckSum)
{
Debug.WriteLine("Table with invalid checksum found in TrueType font file.");
}

if (typeof(T) == typeof(CMapTable))
{
Expand Down

0 comments on commit eb9a191

Please sign in to comment.