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

Skip to content

Commit 45064c7

Browse files
committed
added some more font examples
svn path=/trunk/matplotlib/; revision=1111
1 parent 3dc9527 commit 45064c7

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

examples/backend_driver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
'text_rotation.py',
6363
'text_themes.py',
6464
'two_scales.py',
65+
'unicode_demo.py',
6566
'vline_demo.py',
6667
'zorder_demo.py',
6768
)

lib/matplotlib/backends/backend_ps.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ def _nums_to_str(*args):
4949

5050
def quote_ps_string(s):
5151
"Quote dangerous characters of S for use in a PostScript string constant."
52-
if isinstance(s, unicode):
53-
s = s.encode('ascii', 'replace') # unicode not supported yet
5452
s=s.replace("\\", "\\\\")
5553
s=s.replace("(", "\\(")
5654
s=s.replace(")", "\\)")
@@ -408,9 +406,6 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath):
408406
"""
409407
# local to avoid repeated attribute lookups
410408

411-
if isinstance(s, unicode):
412-
self.draw_unicode(gc, x, y, s, prop, angle)
413-
return
414409

415410
write = self._pswriter.write
416411
if debugPS:
@@ -451,10 +446,12 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath):
451446
""" % locals()
452447
self._draw_ps(ps, gc, None)
453448

454-
else:
455-
if ismath:
456-
return self.draw_mathtext(gc, x, y, s, prop, angle)
449+
elif ismath:
450+
return self.draw_mathtext(gc, x, y, s, prop, angle)
457451

452+
elif isinstance(s, unicode):
453+
return self.draw_unicode(gc, x, y, s, prop, angle)
454+
else:
458455
font = self._get_font_ttf(prop)
459456
font.set_text(s,0)
460457

0 commit comments

Comments
 (0)