Skip to content

Commit 576cd64

Browse files
committed
Fix glyph sizing in textpath.
Scaling by dvifont.size / self.FONT_SCALE resulted in way to small glyphs for many fonts.
1 parent 4833962 commit 576cd64

File tree

3 files changed

+51
-14
lines changed

3 files changed

+51
-14
lines changed
Lines changed: 45 additions & 0 deletions
Loading

lib/matplotlib/tests/test_backend_svg.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,12 @@ def psfont(*args, **kwargs):
182182
fig.savefig(tmpfile, format='svg')
183183

184184

185-
# Use Computer Modern Sans Serif, not Helvetica (which has no \textwon).
186-
@pytest.mark.style('default')
187185
@needs_usetex
188-
def test_unicode_won():
189-
fig = Figure()
190-
fig.text(.5, .5, r'\textwon', usetex=True)
191-
192-
with BytesIO() as fd:
193-
fig.savefig(fd, format='svg')
194-
buf = fd.getvalue().decode('ascii')
195-
196-
won_id = 'Computer_Modern_Sans_Serif-142'
197-
assert re.search(r'<path d=(.|\s)*?id="{0}"/>'.format(won_id), buf)
198-
assert re.search(r'<use[^/>]*? xlink:href="#{0}"/>'.format(won_id), buf)
186+
@image_comparison(baseline_images=['unicode_usetex'], extensions=['svg'])
187+
def test_unicode_usetex():
188+
mpl.rcParams['svg.fonttype'] = 'none'
189+
mpl.style.use('default')
190+
plt.figtext(.5, .5, r'\textdegree', usetex=True)
199191

200192

201193
def test_svgnone_with_data_coordinates():

lib/matplotlib/textpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
321321
glyph_ids.append(char_id)
322322
xpositions.append(x1)
323323
ypositions.append(y1)
324-
sizes.append(dvifont.size / self.FONT_SCALE)
324+
sizes.append(1)
325325

326326
myrects = []
327327

0 commit comments

Comments
 (0)