Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AFM fonts don't have .postscript_name, but .get_fontname(). #10197

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2018

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 8, 2018

rcdefaults()
rcParams["ps.useafm"] = True
rcParams["axes.formatter.use_mathtext"] = True
xlim(-1, 1)
savefig("/tmp/test.ps")

would result in a crash when trying to format a warning because AFM
fonts (which are the only ones used by the StandardPSFonts class (see
constructor and _get_class) don't have a postscript_name attribute;
the corresponding method is get_fontname().

cf #9127, which this partially fixes; however the unicode minus sign is still replaced by a question mark, and given how frequent it is I wonder whether it would make sense to map it to a hyphen or an endash when using afm).

Edit regarding the last note: Or we may just update to a newer version (2.000 (1997) instead of 1.006 (1990)) of the AFM file which is available at http://www.adobe.com/devnet/font.html and includes a "minus" entry (the license for the file is "This file and the 14 PostScript(R) AFM files it accompanies may be used, copied, and distributed for any purpose and without charge, with or without modification, provided that all copyright notices are retained; that the AFM files are not distributed without this file; that all modifications to this file or any of the AFM files are prominently noted in the modified file(s); and that this paragraph is not modified. Adobe Systems has no responsibility or obligation to support the use of the AFM files." which sounds acceptable?)
Note for self: if we switch to the new AFM files, use https://github.com/adobe-type-tools/agl-aglfn for mapping adobe glyph names to unicode entries.

Re-edit: actually the file we ship (phvr8a.afm) already includes a "minus" entry, we just don't map it because we don't have the glyph names mapping... https://www-cdf.fnal.gov/offline/PostScript/PLRM2.pdf page 591 etc for the nitty gritty details

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 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/api_changes.rst if API changed in a backward-incompatible way

```
rcdefaults()
rcParams["ps.useafm"] = True
rcParams["axes.formatter.use_mathtext"] = True
xlim(-1, 1)
savefig("/tmp/test.ps")
```
would result in a crash when trying to format a warning because AFM
fonts (which are the only ones used by the StandardPSFonts class (see
constructor and _get_class) don't have a postscript_name attribute;
the corresponding method is get_fontname().
@QuLogic
Copy link
Member

QuLogic commented Jan 8, 2018

distributed for any purpose and without charge

Not Free.

@anntzer
Copy link
Contributor Author

anntzer commented Jan 8, 2018

Pretty sure this means "without Adobe charging the user" (but worth confirming indeed).

Edit: Actually we already ship that file in the pdfcorefonts folder...

@tacaswell tacaswell added this to the v2.2 milestone Jan 9, 2018
@tacaswell
Copy link
Member

IANAL, but I think that license is kosher to include (given that we already do).

@dopplershift
Copy link
Contributor

@anntzer Are there other changes you wanted to make here?

@anntzer
Copy link
Contributor Author

anntzer commented Jan 17, 2018

not for this pr.

@dopplershift dopplershift merged commit 1eb8013 into matplotlib:master Jan 17, 2018
@anntzer anntzer deleted the mathtext-afm-warning branch January 18, 2018 00:57
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants