textpath encoding - #12928
textpath encoding#12928
Conversation
04dfa60 to
83f2d64
Compare
There was a problem hiding this comment.
|
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
left a comment
There was a problem hiding this comment.
Not clear on all details, but this seems to work...
|
rebased |
2077dc9 to
976e779
Compare
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?
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
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
…928-on-v3.1.x Backport PR #12928 on branch v3.1.x (textpath encoding)

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