Merged
Conversation
04dfa60 to
83f2d64
Compare
anntzer
commented
Dec 4, 2018
lib/matplotlib/textpath.py
Outdated
| # If psfonts.map specifies no encoding, the indices directly map to | ||
| # the font's builtin charmap (see the pdftex manual, section 6.1 | ||
| # -- Map files); so don't use the FreeType-synthesized charmap but | ||
| # the native ones (we can't directly identify it but it's typically |
Contributor
Author
There was a problem hiding this comment.
Contributor
Author
|
Very empirically, it looks like glyphs are correctly sized (across multiple of font sizes) with which doesn't look completely nuts, but I haven't tracked down all the resizings either. |
533b875 to
2077dc9
Compare
jklymak
approved these changes
Mar 4, 2019
Member
jklymak
left a comment
There was a problem hiding this comment.
Not clear on all details, but this seems to work...
Contributor
Author
|
rebased |
2077dc9 to
976e779
Compare
tacaswell
reviewed
Apr 2, 2019
lib/matplotlib/textpath.py
Outdated
| glyph0 = font.load_char(charcode, flags=ft2font_flag) | ||
| # See comments in _get_ps_font_and_encoding. | ||
| if enc is not None: | ||
| index = font.get_name_index(enc[glyph]) |
Member
There was a problem hiding this comment.
this used to handle the case where glyph not in enc where as this looks like it will now raise KeyError. Is this a change we want to make?
Contributor
Author
There was a problem hiding this comment.
Restored handling of glyph not in enc (in the last commit). Not sure why I removed this in the first place.
tacaswell
approved these changes
Apr 2, 2019
Member
tacaswell
left a comment
There was a problem hiding this comment.
modulo the question about changing .get -> [].
976e779 to
51436bf
Compare
Consider the following example.
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
plt.rcParams['text.latex.preamble'] = r'\usepackage{siunitx}'
plt.rcParams['text.hinting_factor'] = 1
plt.text(.5, .5, r'$\si{\degree}$')
plt.text(.5, .4, r'ff\textwon')
plt.gca().set_axis_off()
plt.savefig('/tmp/plot.svg')
plt.savefig('/tmp/plot.pdf')
plt.savefig('/tmp/plot.png')
plt.show()
In the svg output, one sees that the \degree and \textwon characters
(which come from a different font that the ff ligature) are now
correctly loaded, *but* at a too small size -- this still needs to be
fixed.
(pdf and png output are unaffected.)
51436bf to
722de6f
Compare
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Apr 2, 2019
dstansby
added a commit
that referenced
this pull request
Apr 2, 2019
…928-on-v3.1.x Backport PR #12928 on branch v3.1.x (textpath encoding)
This was referenced May 7, 2019
This was referenced Jul 5, 2019
5 tasks
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.
PR Summary
Consider the following example.
In the svg output, one sees that the \degree and \textwon characters

(which come from a different font that the ff ligature) are now
correctly loaded, but at a too small size -- this still needs to be
fixedn but is already better than not loading the glyphs at all.
(pdf and png output are unaffected.)
Supersedes #8286, #8415 (from which a test is taken).
Fixes part of #8068, #8280 (the glyph-loading part; the sizing issue is a bug this PR newly exposes).
Likely the bad font sizing has something to do with the use, in textpath.py of
self.FONT_SCALErather thanprop.get_size_in_points()/dvifont.size...PR Checklist