diff --git a/src/FontLib/Glyph/Outline.php b/src/FontLib/Glyph/Outline.php index 639ff60..b64aff2 100644 --- a/src/FontLib/Glyph/Outline.php +++ b/src/FontLib/Glyph/Outline.php @@ -48,7 +48,7 @@ class Outline extends BinaryStream { static function init(glyf $table, $offset, $size, BinaryStream $font) { $font->seek($offset); - if ($font->readInt16() > -1) { + if ($size === 0 || $font->readInt16() > -1) { /** @var OutlineSimple $glyph */ $glyph = new OutlineSimple($table, $offset, $size); } diff --git a/src/FontLib/Table/Type/cmap.php b/src/FontLib/Table/Type/cmap.php index d09b0dc..fb70f11 100644 --- a/src/FontLib/Table/Type/cmap.php +++ b/src/FontLib/Table/Type/cmap.php @@ -125,6 +125,10 @@ protected function _parse() { } for ($c = $c1; $c <= $c2; $c++) { + if ($c === 0xFFFF) { + continue; + } + if ($ro == 0) { $gid = ($c + $d) & 0xFFFF; } @@ -132,15 +136,17 @@ protected function _parse() { $offset = ($c - $c1) * 2 + $ro; $offset = $ro_start + 2 * $i + $offset; - $font->seek($offset); - $gid = $font->readUInt16(); + $gid = 0; + if ($font->seek($offset) === true) { + $gid = $font->readUInt16(); + } if ($gid != 0) { $gid = ($gid + $d) & 0xFFFF; } } - if ($gid > 0) { + if ($gid >= 0) { $glyphIndexArray[$c] = $gid; } }