Skip to content

Commit

Permalink
Set the head table checkSumAdjustment to zero
Browse files Browse the repository at this point in the history
...before calculating the head table checksum. Per the head table specification:

> checkSumAdjustment: To compute set it to 0, calculate the checksum for the 'head' table and put it in the table directory, sum the entire font as a uint32_t, then store 0xB1B0AFBA - sum. (The checksum for the 'head' table will be wrong as a result. That is OK; do not reset it.)

ref #123
  • Loading branch information
bsweeney committed Dec 12, 2023
1 parent 5ffb691 commit 8d39a08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/FontLib/Table/Type/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@ protected function _parse() {
throw new Exception("Incorrect magic number (" . dechex($this->data["magicNumber"]) . ")");
}
}

function _encode() {
$this->data["checkSumAdjustment"] = 0;
return parent::_encode();
}
}

0 comments on commit 8d39a08

Please sign in to comment.