Skip to content

Commit

Permalink
Ipmproved parsing of TypeOne FontBBox
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Dec 23, 2024
1 parent d8afaba commit 30012e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.2
2.6.3
9 changes: 5 additions & 4 deletions src/Import/TypeOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ protected function extractFontInfo(): void

$this->fdt['name'] = $name;
preg_match('#/FontBBox[\s]*+{([^}]*+)#', $this->font, $matches);
$this->fdt['bbox'] = trim($matches[1]);
$bvl = explode(' ', $this->fdt['bbox']);
$this->fdt['Ascent'] = (int) $bvl[3];
$this->fdt['Descent'] = (int) $bvl[1];
$rawbvl = explode(' ', trim($matches[1]));
$bvl = [(int) $rawbvl[0], (int) $rawbvl[1], (int) $rawbvl[2], (int) $rawbvl[3]];
$this->fdt['bbox'] = implode(' ', $bvl);
$this->fdt['Ascent'] = $bvl[3];
$this->fdt['Descent'] = $bvl[1];
preg_match('#/ItalicAngle[\s]*+([0-9\+\-]*+)#', $this->font, $matches);
$this->fdt['italicAngle'] = (int) $matches[1];

Expand Down

0 comments on commit 30012e3

Please sign in to comment.