Skip to content

Commit 18de7b3

Browse files
author
Indrek Altpere
committed
Use the multi-read helper to read all the hmtx values in one go
1 parent bccb423 commit 18de7b3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/FontLib/Table/Type/hmtx.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ protected function _parse() {
2525
$font->seek($offset);
2626

2727
$data = array();
28-
for ($gid = 0; $gid < $numOfLongHorMetrics; $gid++) {
29-
$advanceWidth = $font->readUInt16();
30-
$leftSideBearing = $font->readUInt16();
28+
$metrics = $font->readUInt16Many($numOfLongHorMetrics * 2);
29+
for ($gid = 0, $mid = 0; $gid < $numOfLongHorMetrics; $gid++) {
30+
$advanceWidth = $metrics[$mid++];
31+
$leftSideBearing = $metrics[$mid++];
3132
$data[$gid] = array($advanceWidth, $leftSideBearing);
3233
}
3334

0 commit comments

Comments
 (0)