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

Skip to content

Commit 8c3218b

Browse files
committed
Merged revisions 7800 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7800 | jouni | 2009-09-20 22:47:46 +0300 (Su, 20 Syy 2009) | 1 line Fix usetex spacing errors in pdf backend. ........ svn path=/trunk/matplotlib/; revision=7801
1 parent 1ea52fd commit 8c3218b

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
2009-09-20 Fix usetex spacing errors in pdf backend. - JKS
2+
13
2009-09-20 Add Sphinx extension to highlight IPython console sessions,
24
originally authored (I think) by Michael Droetboom. - FP
35

46
2009-09-20 Fix off-by-one error in dviread.Tfm, and additionally protect
5-
against exceptions in case a dvi font is missing some metrics - JKS
7+
against exceptions in case a dvi font is missing some metrics. - JKS
68

79
2009-09-15 Implement draw_text and draw_tex method of backend_base using
810
the textpath module. Implement draw_tex method of the svg

lib/matplotlib/backends/backend_pdf.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,14 @@ def draw_tex(self, gc, x, y, s, prop, angle):
14791479
dvi.close()
14801480

14811481
# Gather font information and do some setup for combining
1482-
# characters into strings.
1482+
# characters into strings. The variable seq will contain a
1483+
# sequence of font and text entries. A font entry is a list
1484+
# ['font', name, size] where name is a Name object for the
1485+
# font. A text entry is ['text', x, y, glyphs, x+w] where x
1486+
# and y are the starting coordinates, w is the width, and
1487+
# glyphs is a list; in this phase it will always contain just
1488+
# one one-character string, but later it may have longer
1489+
# strings interspersed with kern amounts.
14831490
oldfont, seq = None, []
14841491
for x1, y1, dvifont, glyph, width in page.text:
14851492
if dvifont != oldfont:
@@ -1499,16 +1506,18 @@ def draw_tex(self, gc, x, y, s, prop, angle):
14991506
# Find consecutive text strings with constant y coordinate and
15001507
# combine into a sequence of strings and kerns, or just one
15011508
# string (if any kerns would be less than 0.1 points).
1502-
i, curx = 0, 0
1509+
i, curx, fontsize = 0, 0, None
15031510
while i < len(seq)-1:
15041511
elt, next = seq[i:i+2]
1505-
if elt[0] == next[0] == 'text' and elt[2] == next[2]:
1512+
if elt[0] == 'font':
1513+
fontsize = elt[2]
1514+
elif elt[0] == next[0] == 'text' and elt[2] == next[2]:
15061515
offset = elt[4] - next[1]
15071516
if abs(offset) < 0.1:
15081517
elt[3][-1] += next[3][0]
15091518
elt[4] += next[4]-next[1]
15101519
else:
1511-
elt[3] += [offset*1000.0/dvifont.size, next[3][0]]
1520+
elt[3] += [offset*1000.0/fontsize, next[3][0]]
15121521
elt[4] = next[4]
15131522
del seq[i+1]
15141523
continue

0 commit comments

Comments
 (0)