Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Move PostScript Type3 subsetting to pure python.#18370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:masterfromanntzer:unttps
Oct 3, 2020

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedAug 28, 2020
edited
Loading

... 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_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 usingexec (_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.

PR Summary

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings andpydocstyle<4 and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

Copy link
Member

@QuLogicQuLogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is this safe, or do you need to escape any Postscript special values?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this should be safe perhttps://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...

@anntzer
Copy link
ContributorAuthor

I also moved thebind defs to the global mpldict, which avoids having to repeat them for every font.

Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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 nobaseline images for which we need to provide bug-level backcompat :-)Drop the FontInfo metadata (which is explicitly optional in thePostScript 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 istaken).Drop the splitting of long commands using `exec` (`_e`) -- this is onlyneeded for level-1 postscript, which has a small fixed stack size; weoutput level-2 postscript (per backend_version) and I guess level-1 israrely in use nowadays anyways (probably the feature could be added backif 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, butI'd guess outputting .ps.gz is better if compression really matters.
@timhoffmtimhoffm merged commitdd15dc0 intomatplotlib:masterOct 3, 2020
@timhoffmtimhoffm added this to thev3.4.0 milestoneOct 3, 2020
@anntzeranntzer deleted the unttps branchOctober 4, 2020 07:06
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

@jkseppanjkseppanAwaiting requested review from jkseppan

Assignees
No one assigned
Projects
None yet
Milestone
v3.4.0
Development

Successfully merging this pull request may close these issues.

3 participants
@anntzer@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp