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

Reduce numerical precision in Type 1 fonts#18080

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
tacaswell merged 2 commits intomatplotlib:masterfromjkseppan:type1-rounding
Jul 28, 2020

Conversation

jkseppan
Copy link
Member

@jkseppanjkseppan commentedJul 27, 2020
edited
Loading

Fixes#16087

PR Summary

Numbers such as

/ItalicAngle -9.48090361795083 def/FontMatrix [0.001 0.0 0.00016700000000000002 0.001 0.0 0.0] readonly def

seem to confuse some PostScript parsers, so output fewer digits when changing the angle of a font.

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/next_api_changes/* if API changed in a backward-incompatible way

2xmax reacted with thumbs up emoji
@jkseppanjkseppan requested a review fromanntzerJuly 27, 2020 07:03
as_string = '[' + ' '.join(str(x) for x in array) + ']'
return as_string.encode('latin-1')
return (
'[' + ' '.join(f'{x:.5g}' for x in array) + ']'
Copy link
Contributor

@anntzeranntzerJul 27, 2020
edited
Loading

Choose a reason for hiding this comment

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

perhaps .5f instead?
(I'm currently away from doing real reviewing so don't wait for me, but the PR certainly looks reasonable.)

Copy link
Member

Choose a reason for hiding this comment

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

I cannot comment on g vs. f, but I would prefer

Suggested change
'['+' '.join(f'{x:.5g}'forxinarray)+']'
'[%s]'%' '.join(f'{x:.5g}'forxinarray)

which is slightly more readable IMHO. But I won't block over this.

Copy link
Contributor

@anntzeranntzerJul 27, 2020
edited
Loading

Choose a reason for hiding this comment

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

(the problem with 'g' is exponent notation: does postscript actually support notation such as '1e4'? (I don't know))

Copy link
Member

Choose a reason for hiding this comment

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

Postscript supports exponent notation:

NumbersNumbers in the PostScript language include signed integers, such as
123 –98 43445 0 +17
reals, such as
–.002 34.5 –3.62 123.6e10 1E–5 –1. 0.0
and radix numbers, such as
8#1777 16#FFFE 2#1000

https://www.adobe.com/content/dam/acom/en/devnet/actionscript/articles/psrefman.pdf page 27

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that's fine then.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yeah, I thought we should keep a small number of significant digits instead of just rounding to a fixed number of decimals. But on second thought there is little point, since the scale is fixed: fonts are written in terms of 1000 or 1024 units as the side of the design square, so the values on the diagonal are around 0.001. The off-diagonal values are either zero or of similar magnitude as 0.001, otherwise there is no visible effect. We can as well use %f.

@tacaswelltacaswell added this to thev3.4.0 milestoneJul 27, 2020
This avoids exponential notation (which is supported by PS but whoknows how all the different parsers react to it) and trailing zeros,so we don't unnecessarily increase the size of fonts that have anice [0.001 0 0 0.001] matrix.Encapsulate the formatting operation in a cbook function and giveit a unit test.
@tacaswelltacaswell merged commitb5eca56 intomatplotlib:masterJul 28, 2020
@tacaswell
Copy link
Member

Thanks@jkseppan !

Have not heard from you in a while, I hope you and your family are doing well.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer left review comments

@tacaswelltacaswelltacaswell approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

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

Successfully merging this pull request may close these issues.

Error with greek letters in pdf export when using usetex=True and mathptmx
4 participants
@jkseppan@tacaswell@anntzer@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp