Skip to content

Commit

Permalink
Include replacement characters in Cpdf font subset
Browse files Browse the repository at this point in the history
These characters aren't (typically) referenced in the PDF and so aren't included in font subsets generated based on the text content. As a result, if an unsupported character is in the document the space occupied by it will be blank when subsetting is enabled.
  • Loading branch information
bsweeney committed Aug 25, 2022
1 parent f5da2fd commit 9adb812
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Cpdf.php
Expand Up @@ -5013,7 +5013,8 @@ function registerText($font, $text)
}

if (!isset($this->stringSubsets[$font])) {
$this->stringSubsets[$font] = [];
$base_subset = "\u{fffd}\u{fffe}\u{ffff}";
$this->stringSubsets[$font] = $this->utf8toCodePointsArray($base_subset);
}

$this->stringSubsets[$font] = array_unique(
Expand Down

0 comments on commit 9adb812

Please sign in to comment.