Move PostScript Type3 subsetting to pure python.#18370
Merged
timhoffm merged 1 commit intomatplotlib:masterfrom Oct 3, 2020
Merged
Move PostScript Type3 subsetting to pure python.#18370timhoffm merged 1 commit intomatplotlib:masterfrom
timhoffm merged 1 commit intomatplotlib:masterfrom
Conversation
da4513e to
1c0b4f4
Compare
QuLogic
reviewed
Sep 1, 2020
Member
QuLogic
left a comment
There was a problem hiding this comment.
Can't say I understand PostScript, but this seems reasonable from what I read of the spec.
| """.format(font_name=font.postscript_name, | ||
| inv_units_per_em=1 / font.units_per_EM, | ||
| bbox=" ".join(map(str, font.bbox)), | ||
| encoding=" ".join("/{}".format(font.get_glyph_name(glyph_id)) |
Member
There was a problem hiding this comment.
Is this safe, or do you need to escape any Postscript special values?
Contributor
Author
There was a problem hiding this comment.
this should be safe per https://github.com/adobe-type-tools/agl-specification#6-assigning-glyph-names-in-new-fonts. We can always revisit if someone finds a font with a bad glyph name...
QuLogic
reviewed
Sep 1, 2020
Contributor
Author
|
I also moved the |
QuLogic
approved these changes
Sep 1, 2020
timhoffm
reviewed
Oct 3, 2020
Member
timhoffm
left a comment
There was a problem hiding this comment.
I almost dare approve based on my non-existing postscript knowledge, modulo a docstring that can at least give me an idea.
... similarly to the change for pdf, but easier because there are no
baseline images for which we need to provide bug-level backcompat :-)
Drop the FontInfo metadata (which is explicitly optional in the
PostScript spec) to avoid having to figure out the correct encoding
(which can be quite obscure).
Replace the implementation of the `_sc` command from
`7 -1 roll{setcachedevice}{pop pop pop pop pop pop}ifelse` to a plain
`setcachedevice` (as I cannot see any case where the "other" branch is
taken).
Drop the splitting of long commands using `exec` (`_e`) -- this is only
needed for level-1 postscript, which has a small fixed stack size; we
output level-2 postscript (per backend_version) and I guess level-1 is
rarely in use nowadays anyways (probably the feature could be added back
if there's really demand for it, but let's not get ahead of ourselves).
Previously, some composite characters would be output in a "compressed"
form (e.g., accented characters would be recorded as "draw the accent,
then run the charproc for the unaccented character"). This is lost, but
I'd guess outputting .ps.gz is better if compression really matters.
timhoffm
approved these changes
Oct 3, 2020
5 tasks
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.
... similarly to the change for pdf (#18181), but easier because there are no
baseline images for which we need to provide bug-level backcompat :-)
Drop the FontInfo metadata (which is explicitly optional in the
PostScript spec) to avoid having to figure out the correct encoding
(which can be quite obscure).
Replace the implementation of the
_sccommand from7 -1 roll{setcachedevice}{pop pop pop pop pop pop}ifelseto a plainsetcachedevice(as I cannot see any case where the "other" branch istaken).
Drop the splitting of long commands using
exec(_e) -- this is onlyneeded for level-1 postscript, which has a small fixed stack size; we
output level-2 postscript (per backend_version) and I guess level-1 is
rarely in use nowadays anyways (probably the feature could be added back
if there's really demand for it, but let's not get ahead of ourselves).
Previously, some composite characters would be output in a "compressed"
form (e.g., accented characters would be recorded as "draw the accent,
then run the charproc for the unaccented character"). This is lost, but
I'd guess outputting .ps.gz is better if compression really matters.
PR Summary
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsandpydocstyle<4and runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).