-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add font fallback + Support for font IDs containing hyphens (#614)
* Add font choice fallback + fonts w/ hyphen If a text stream is "decoded" and contains UTF-8 control characters, it probably wasn't decoded using the proper font code page. Add a loop that cycles through all the available fonts to see if there's a better decode choice. Resolves Issue 586. As well, add the ability to parse font IDs containing dashes (-). Resolves Issue 145 * Update PDFObjectTest.php Simplify these tests in case future edits change spacing rules. * Refactor duplicate code into a function * Use single quoted regexp Let PCRE handle the conversion rather than PHP. Hopefully fixes PHPStan complaints about null byte. * Add @param for $command and ?Page * Proper indentation. * fixing coding style issues in PDFObject.php ref: https://cs.symfony.com/doc/rules/function_notation/nullable_type_declaration_for_default_null_value.html * reverted coding style adaptions * Remove test case PDF Remove the Font ID with hyphen test case PDF as we could not contact the submitter to get permission to use it. Change the unit test to directly test if a Font ID with a hyphen is correctly parsed. * Add one extra test for font-fallback Add one more test for font-fallback. This addition also resolves #495. Catches situations where a null byte \x00 may not be found by preg_match in a unicode context. Null bytes in the text string usually means that a CIDMap encoded string has been passed through as UTF-8 bytes without being translated by any matching CIDMap pairs. --------- Co-authored-by: Konrad Abicht <hi@inspirito.de>
- Loading branch information
1 parent
5c82748
commit ce434c1
Showing
4 changed files
with
80 additions
and
7 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters