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

Skip to content

Commit d158b7e

Browse files
committed
Fix bug when rendering character codes > 255 in PDF
svn path=/trunk/matplotlib/; revision=3674
1 parent 96f5450 commit d158b7e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/matplotlib/backends/backend_pdf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
11031103
oldx, oldy = 0, 0
11041104
for record in pswriter:
11051105
if record[0] == 'glyph':
1106-
rec_type, ox, oy, fontname, fontsize, glyph = record
1106+
rec_type, ox, oy, fontname, fontsize, num = record
11071107
a = angle / 180.0 * pi
11081108
newx = x + cos(a)*ox - sin(a)*oy
11091109
newy = y + sin(a)*ox + cos(a)*oy
@@ -1114,7 +1114,10 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
11141114
Op.selectfont)
11151115
prev_font = fontname, fontsize
11161116

1117-
string = chr(glyph)
1117+
if num < 256:
1118+
string = chr(num)
1119+
else:
1120+
string = "?"
11181121
self.file.output(string, Op.show)
11191122
self.file.output(Op.end_text)
11201123

0 commit comments

Comments
 (0)