prevent font name collision corrupting _fontFamilies and PDF output#1706
Open
andreiaugustin wants to merge 3 commits intofoliojs:masterfrom
Open
prevent font name collision corrupting _fontFamilies and PDF output#1706andreiaugustin wants to merge 3 commits intofoliojs:masterfrom
andreiaugustin wants to merge 3 commits intofoliojs:masterfrom
Conversation
Contributor
Author
|
Here's the code I've used to test for the extra safety net: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug fix
What kind of change does this PR introduce?
This should fix #1651 - basically when a doc mixes standard and embedded fonts that share the same postscript name, as it is the case in the built-in Helvetica and Helvetica.ttf, the name-based alias in
_fontFamilieswas getting overwritten, causing one font to never be finalised and resulted in a corrupt PDF.With this change, the name-based slot in
_fontFamiliesis now only written if it is not already occupied, preserving whichever font was registered first.Furthermore, an extra safety net is added for fonts loaded via raw buffer with no
cacheKey, whose ps name collides with already registered fonts, which would otherwise slip through both registration paths - it now gets registered under its unique id so it is always reachable during finalisation.Checklist: