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

Skip to content

Commit f3546ae

Browse files
committed
Small fixes to mathtext2.py in order to keep up with the changes to the mpl-data dir.
svn path=/trunk/matplotlib/; revision=3042
1 parent 8bc7786 commit f3546ae

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

examples/mathtext2_demo.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939

4040
# You can put other fonts to override the default ones
4141
rcParams['mathtext.rm'] = 'FreeSerif.ttf'
42-
#rcParams['mathtext.it'] = 'FreeSerifItalic.ttf'
43-
#rcParams['mathtext.tt'] = 'FreeMono.ttf'
44-
#rcParams['mathtext.mit'] = 'FreeSerifItalic.ttf'
45-
#rcParams['mathtext.cal'] = 'FreeSansOblique.ttf'
42+
rcParams['mathtext.it'] = 'FreeSerifItalic.ttf'
43+
rcParams['mathtext.tt'] = 'FreeMono.ttf'
44+
rcParams['mathtext.mit'] = 'FreeSerifItalic.ttf'
45+
rcParams['mathtext.cal'] = 'FreeSansOblique.ttf'
4646

4747
# This is used by mathtext2 to find chars with ord > 255 (Unicode characters)
4848
rcParams['mathtext.nonascii'] = 'FreeSerif.ttf'
@@ -69,7 +69,6 @@
6969
#tex = ur"$a^{\sin x}\sin b\sin(x/x), {\rm sin}(x/x){\rm sin\ }(x/x)$"
7070
#tex = ur"$1\frac {\int_{-\infty}^\infty} 22$"
7171
#tex = ur"$\rm a\vtext{Traktor}b$"
72-
tex = ur"$a\vtext{a}$"
7372
#tex = ur"$\frac{\int_{-\infty}^\infty} 2$"
7473
#tex = ur"$1_\frac{\sum^2_{i_{23}=0}} 2678$"
7574
#tex = ur"$1_{\frac{\sum^2_{i_{23}=0}}{\sum_{i=\frac94}^\infty} 345}678$"
@@ -82,9 +81,9 @@
8281
#text(1, 1.5, tex, fontsize=20)
8382
#title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20)
8483

85-
#savefig('mathtext_demo.png')
84+
savefig('mathtext_demo.png')
8685
savefig('mathtext_demo.svg')
87-
#savefig('mathtext_demo.ps')
86+
savefig('mathtext_demo.ps')
8887

8988

9089
show()

lib/matplotlib/mathtext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ def _get_info (self, font, sym, fontsize, dpi):
750750
num = ord(sym)
751751
else:
752752
num = 0
753-
sym = '.notdef'
753+
#sym = '.notdef'
754754
raise ValueError('unrecognized symbol "%s, %d"' % (sym, num))
755755
filename = os.path.join(self.basepath, basename) + '.ttf'
756756
if filename not in bakoma_fonts:

lib/matplotlib/mathtext2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656
fontdirs = [os.path.join(_path,'fonts','afm'),
5757
os.path.join(_path,'fonts','ttf')]
5858
for fontdir in fontdirs:
59-
fname = os.path.join(fontdir,barefname)
59+
fname = os.path.join(fontdir, barefname)
6060
if os.path.exists( fname ):
61-
filenamesd[face] = os.path.join(_path, barefname)
61+
filenamesd[face] = fname
6262
break
6363
fonts[face] = FT2Font(filenamesd[face])
6464

@@ -856,9 +856,9 @@ def handle_command(command, texgroup, env, allowsetters=False):
856856
elif command in reserved:
857857
uniindex = ord(command)
858858
appendix = handle_char(uniindex, env.copy())
859-
elif command == "vtext":
860-
_vlist = texgroup.pop(0)
861-
appendix = handle_tokens(_vlist, env.copy(), box=Vbox)
859+
#elif command == "vtext":
860+
# _vlist = texgroup.pop(0)
861+
# appendix = handle_tokens(_vlist, env.copy(), box=Vbox)
862862
elif command in tex2uni:
863863
uniindex = tex2uni[command]
864864
appendix = handle_char(uniindex, env.copy())

0 commit comments

Comments
 (0)