We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3134163 commit 2bd575bCopy full SHA for 2bd575b
src/FontLib/Table/DirectoryEntry.php
@@ -49,20 +49,8 @@ static function computeChecksum($data) {
49
$data = str_pad($data, $len + (4 - $mod), "\0");
50
}
51
52
- $len = mb_strlen($data, '8bit');
53
-
54
- $hi = 0x0000;
55
- $lo = 0x0000;
56
57
- for ($i = 0; $i < $len; $i += 4) {
58
- $hi += (ord($data[$i]) << 8) + ord($data[$i + 1]);
59
- $lo += (ord($data[$i + 2]) << 8) + ord($data[$i + 3]);
60
- $hi += $lo >> 16;
61
- $lo = $lo & 0xFFFF;
62
- $hi = $hi & 0xFFFF;
63
- }
64
65
- return ($hi << 8) + $lo;
+ $table = unpack("N*", $data);
+ return array_sum($table);
66
67
68
function __construct(File $font) {
0 commit comments