AFM fonts don't have .postscript_name, but .get_fontname(). #10197
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.
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