8000 Merge pull request #2636 from mdboom/font/unicode-python3-pdf · matplotlib/matplotlib@45ee98c · GitHub
[go: up one dir, main page]

Skip to content

Commit 45ee98c

Browse files
committed
Merge pull request #2636 from mdboom/font/unicode-python3-pdf
"\usepackage[russian]{babel}" does not work in matplotlib 1.3.1
2 parents a0bb747 + 38d846b commit 45ee98c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,9 @@ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
17451745
dvifont=dvifont)
17461746
seq += [['font', pdfname, dvifont.size]]
17471747
oldfont = dvifont
1748-
seq += [['text', x1, y1, [chr(glyph)], x1+width]]
1748+
# We need to convert the glyph numbers to bytes, and the easiest
1749+
# way to do this on both Python 2 and 3 is .encode('latin-1')
1750+
seq += [['text', x1, y1, [chr(glyph).encode('latin-1')], x1+width]]
17491751

17501752
# Find consecutive text strings with constant y coordinate and
17511753
# combine into a sequence of strings and kerns, or just one

0 commit comments

Comments
 (0)
0