Skip to content

Commit bb3905e

Browse files
committed
reverted ftfont name handling to str
svn path=/trunk/matplotlib/; revision=1124
1 parent 9cb670a commit bb3905e

18 files changed

+226
-58
lines changed

API_CHANGES

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
Added auto legen capability from sprint -- 'best' is new default
3-
41
API CHANGES in matplotlib-0.73
52

63
Removed deprecated ColormapJet and friends

CHANGELOG

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
New entries should be added at the top
22

3-
2005-03-30 Fixed and added checks for floating point inaccuracy in ticker.Base - DSD
3+
2005-03-30 Fixed and added checks for floating point inaccuracy in
4+
ticker.Base - DSD
45

5-
2005-03-30 updated /ellipse definition in backend_ps.py to address
6-
bug #1122041 - DSD
6+
2005-03-30 updated /ellipse definition in backend_ps.py to address bug
7+
#1122041 - DSD
78

89
2005-03-29 Added unicode support for Agg and PS - JDH
910

1011
2005-03-28 Added Jarrod's svg patch for text - JDH
1112

12-
2005-03-28 Added ludal arrow and quiver patch - JDH
13+
2005-03-28 Added Ludal's arrow and quiver patch - JDH
1314

1415
2005-03-28 Added label kwarg to Axes to facilitate forcing the
1516
creation of new Axes with otherwise identical attributes

LICENSE/LICENSE

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LICENSE AGREEMENT FOR MATPLOTLIB 0.73.1
1+
LICENSE AGREEMENT FOR MATPLOTLIB 0.74
22
--------------------------------------
33

44
1. This LICENSE AGREEMENT is between John D. Hunter ("JDH"), and the
@@ -9,30 +9,30 @@ documentation.
99
2. Subject to the terms and conditions of this License Agreement, JDH
1010
hereby grants Licensee a nonexclusive, royalty-free, world-wide license
1111
to reproduce, analyze, test, perform and/or display publicly, prepare
12-
derivative works, distribute, and otherwise use matplotlib 0.73.1
12+
derivative works, distribute, and otherwise use matplotlib 0.74
1313
alone or in any derivative version, provided, however, that JDH's
1414
License Agreement and JDH's notice of copyright, i.e., "Copyright (c)
1515
2002-2005 John D. Hunter; All Rights Reserved" are retained in
16-
matplotlib 0.73.1 alone or in any derivative version prepared by
16+
matplotlib 0.74 alone or in any derivative version prepared by
1717
Licensee.
1818

1919
3. In the event Licensee prepares a derivative work that is based on or
20-
incorporates matplotlib 0.73.1 or any part thereof, and wants to
20+
incorporates matplotlib 0.74 or any part thereof, and wants to
2121
make the derivative work available to others as provided herein, then
2222
Licensee hereby agrees to include in any such work a brief summary of
23-
the changes made to matplotlib 0.73.1.
23+
the changes made to matplotlib 0.74.
2424

25-
4. JDH is making matplotlib 0.73.1 available to Licensee on an "AS
25+
4. JDH is making matplotlib 0.74 available to Licensee on an "AS
2626
IS" basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
2727
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND
2828
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
29-
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.73.1
29+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.74
3030
WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
3131

3232
5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB
33-
0.73.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
33+
0.74 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR
3434
LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING
35-
MATPLOTLIB 0.73.1, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
35+
MATPLOTLIB 0.74, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF
3636
THE POSSIBILITY THEREOF.
3737

3838
6. This License Agreement will automatically terminate upon a material
@@ -44,6 +44,6 @@ Licensee. This License Agreement does not grant permission to use JDH
4444
trademarks or trade name in a trademark sense to endorse or promote
4545
products or services of Licensee, or any third party.
4646

47-
8. By copying, installing or otherwise using matplotlib 0.73.1,
47+
8. By copying, installing or otherwise using matplotlib 0.74,
4848
Licensee agrees to be bound by the terms and conditions of this License
4949
Agreement.

MANIFEST

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ examples/backend_driver.py
262262
examples/bar_stacked.py
263263
examples/barchart_demo.py
264264
examples/barh_demo.py
265+
examples/boxplot_demo.py
265266
examples/break.py
266267
examples/color_demo.py
267268
examples/colours.py
@@ -301,6 +302,7 @@ examples/fill_between_posneg.py
301302
examples/fill_demo.py
302303
examples/fill_spiral.py
303304
examples/finance_demo.py
305+
examples/font_indexing.py
304306
examples/font_table_ttf.py
305307
examples/fonts_demo.py
306308
examples/fonts_demo_kw.py
@@ -322,6 +324,7 @@ examples/interactive2.py
322324
examples/invert_axes.py
323325
examples/keypress_demo.py
324326
examples/layer_images.py
327+
examples/legend_auto.py
325328
examples/legend_demo.py
326329
examples/legend_demo2.py
327330
examples/line_styles.py
@@ -355,6 +358,7 @@ examples/printing_in_wx.py
355358
examples/psd_demo.py
356359
examples/pstest.py
357360
examples/pythonic_matplotlib.py
361+
examples/quiver_demo.py
358362
examples/scatter_demo.py
359363
examples/scatter_demo2.py
360364
examples/scatter_profile.py
@@ -373,6 +377,7 @@ examples/text_themes.py
373377
examples/to_numeric.py
374378
examples/toggle_images.py
375379
examples/two_scales.py
380+
examples/unicode_demo.py
376381
examples/vertical_ticklabels.py
377382
examples/vline_demo.py
378383
examples/webapp_demo.py
@@ -510,7 +515,6 @@ lib/dateutil/rrule.py
510515
lib/dateutil/tz.py
511516
lib/matplotlib/.cvsignore
512517
lib/matplotlib/__init__.py
513-
lib/matplotlib/__init__.py.~1.45.~
514518
lib/matplotlib/_contour.py
515519
lib/matplotlib/_image.py
516520
lib/matplotlib/_mathtext_data.py
@@ -538,6 +542,7 @@ lib/matplotlib/mathtext.py
538542
lib/matplotlib/mlab.py
539543
lib/matplotlib/patches.py
540544
lib/matplotlib/pylab.py
545+
lib/matplotlib/pylab.py.orig
541546
lib/matplotlib/pyparsing.py
542547
lib/matplotlib/table.py
543548
lib/matplotlib/text.py

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ clean:
2121

2222

2323
release: ${DISTFILES}
24-
rm -r MANIFEST;\
24+
rm -f MANIFEST;\
2525
${PYTHON} license.py ${VERSION} license/LICENSE;\
2626
${PYTHON} setup.py sdist --formats=gztar,zip;
2727

examples/legend_auto.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,55 +17,55 @@ def fig_1():
1717
figure(1)
1818
t = arange(0, 40.0 * pi, 0.1)
1919
l, = plot(t, 100*sin(t), 'r', label='sine')
20-
legend()
20+
legend(loc='best')
2121

2222
def fig_2():
2323
figure(2)
2424
plot(x, 'o', label='x=y')
25-
legend()
25+
legend(loc='best')
2626

2727
def fig_3():
2828
figure(3)
2929
plot(x, -x, 'o', label='x= -y')
30-
legend()
30+
legend(loc='best')
3131

3232
def fig_4():
3333
figure(4)
3434
plot(x, ones(len(x)), 'o', label='y=1')
3535
plot(x, -ones(len(x)), 'o', label='y=-1')
36-
legend()
36+
legend(loc='best')
3737

3838
def fig_5():
3939
figure(5)
4040
n, bins, patches = hist(randn(1000), 40, normed=1)
4141
l, = plot(bins, normpdf(bins, 0.0, 1.0), 'r--', label='fit', linewidth=3)
42-
legend([l, patches[0]], ['fit', 'hist'])
42+
legend([l, patches[0]], ['fit', 'hist'], loc='best')
4343

4444
def fig_6():
4545
figure(6)
4646
plot(x, 50-x, 'o', label='y=1')
4747
plot(x, x-50, 'o', label='y=-1')
48-
legend()
48+
legend(loc='best')
4949

5050
def fig_7():
5151
figure(7)
5252
xx = x - (N/2.0)
5353
plot(xx, (xx*xx)-1225, 'bo', label='$y=x^2$')
5454
plot(xx, 25*xx, 'go', label='$y=25x$')
5555
plot(xx, -25*xx, 'mo', label='$y=-25x$')
56-
legend()
56+
legend(loc='best')
5757

5858
def fig_8():
5959
figure(8)
6060
b1 = bar(x, x, color='m')
6161
b2 = bar(x, x[::-1], color='g')
62-
legend([b1[0], b2[0]], ['up', 'down'])
62+
legend([b1[0], b2[0]], ['up', 'down'], loc='best')
6363

6464
def fig_9():
6565
figure(9)
6666
b1 = bar(x, -x)
6767
b2 = bar(x, -x[::-1], color='r')
68-
legend([b1[0], b2[0]], ['down', 'up'])
68+
legend([b1[0], b2[0]], ['down', 'up'], loc='best')
6969

7070
def fig_10():
7171
figure(10)
@@ -74,7 +74,8 @@ def fig_10():
7474
b3 = bar(x, -x, bottom=100)
7575
b4 = bar(x, -x[::-1], bottom=100, color='r')
7676
legend([b1[0], b2[0], b3[0], b4[0]], ['bottom right', 'bottom left',
77-
'top left', 'top right'])
77+
'top left', 'top right'],
78+
loc='best')
7879

7980
if __name__ == '__main__':
8081
nfigs = 10

examples/unicode_demo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xlabel( unicode("réactivité nous permettent d'être sélectionnés et adoptés", 'latin-1') )
88
ylabel( unicode('Andr\xc3\xa9 was here!', 'utf-8') )
99
text( 0.5, 2.5, unicode('Institut für Festkörperphysik', 'latin-1'), rotation=45)
10-
text( 2, 2.5, u'AVA')
10+
text( 1, 1.5, u'AVA (check kerning)')
11+
1112
savefig('test.ps')
1213
show()

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"""
143143
from __future__ import generators
144144

145-
__version__ = '0.73.1'
145+
__version__ = '0.74'
146146
__revision__ = '$Revision$'
147147
__date__ = '$Date$'
148148

lib/matplotlib/axes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3351,12 +3351,14 @@ def connect(self, s, func):
33513351
33523352
func(ax) # where ax is the instance making the callback.
33533353
3354-
The following events can be connected to: %s
3354+
The following events can be connected to:
3355+
3356+
'xlim_changed','ylim_changed'
33553357
33563358
The connection id is is returned - you can use this with
33573359
disconnect to disconnect from the axes event
33583360
3359-
""" % ', '.join(Axes._events)
3361+
"""
33603362

33613363
if s not in Axes._events:
33623364
raise ValueError('You can only connect to the following axes events: %s' % ', '.join(Axes._events))

lib/matplotlib/backends/backend_agg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def _get_agg_font(self, prop):
244244

245245
if font is None:
246246
fname = fontManager.findfont(prop)
247-
font = FT2Font(fname)
247+
font = FT2Font(str(fname))
248248
_fontd[key] = font
249249

250250
font.clear()

lib/matplotlib/backends/backend_ps.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def _get_font_ttf(self, prop):
194194
font = _fontd.get(key)
195195
if font is None:
196196
fname = fontManager.findfont(prop)
197-
font = FT2Font(fname)
197+
font = FT2Font(str(fname))
198198
_fontd[key] = font
199199
if fname not in _type42:
200200
_type42.append(fname)
@@ -491,10 +491,15 @@ def draw_unicode(self, gc, x, y, s, prop, angle):
491491
thisx, thisy = 0,0
492492
for c in s:
493493
ccode = ord(c)
494-
gind = glyphd[ccode]
494+
gind = glyphd.get(ccode)
495+
if gind is None:
496+
ccode = ord('?')
497+
name = '.notdef'
498+
gind = 0
499+
else:
500+
name = font.get_glyph_name(gind)
495501
glyph = font.load_char(ccode)
496502

497-
name = font.get_glyph_name(gind)
498503
if lastgind is not None:
499504
kern = font.get_kerning(lastgind, gind, KERNING_UNFITTED)
500505
else:
@@ -598,7 +603,7 @@ def encodeTTFasPS(fontfile):
598603
data = font.read(65520)
599604

600605
hexdata = ''.join(hexdata)[:-2] + '00>'
601-
font = FT2Font(fontfile)
606+
font = FT2Font(str(fontfile))
602607

603608
headtab = font.get_sfnt_table('head')
604609
version = '%d.%d' % headtab['version']
@@ -773,7 +778,7 @@ def print_figure(self, outfile, dpi=72,
773778
print >>fh, l.strip()
774779
if not rcParams['ps.useafm']:
775780
for font in type42:
776-
print >>fh, "%%BeginFont: "+FT2Font(font).postscript_name
781+
print >>fh, "%%BeginFont: "+FT2Font(str(font)).postscript_name
777782
print >>fh, encodeTTFasPS(font)
778783
print >>fh, "%%EndFont"
779784
print >>fh, "%%EndProlog"

lib/matplotlib/collections.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,12 @@ def get_verts(self):
435435
offsets = [(0,0)]
436436
else:
437437
offsets = self._offsets
438-
N = max(len(offsets), len(self._verts))
438+
Noffsets = len(offsets)
439+
Nsegments = len(self._segments)
439440
vertsall = []
440-
for i in range(N):
441-
ox, oy = offsets[i%N]
442-
verts = self._segments[i%N]
441+
for i in range(max(Noffsets, Nsegments)):
442+
#print i, N, i%N, len(offsets)
443+
ox, oy = offsets[i%Noffsets]
444+
verts = self._segments[i%Nsegments]
443445
vertsall.extend([(x+ox, y+oy) for x,y in verts])
444446
return vertsall

lib/matplotlib/font_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def createFontDict(fontfiles, fontext='ttf'):
460460
prop = afmFontProperty(font)
461461
else:
462462
try:
463-
font = ft2font.FT2Font(fpath)
463+
font = ft2font.FT2Font(str(fpath))
464464
except RuntimeError:
465465
warnings.warn("Could not open font file %s"%fpath)
466466
continue
@@ -636,7 +636,7 @@ def get_name(self):
636636
"""Return the name of the font that best matches the font
637637
properties.
638638
"""
639-
return ft2font.FT2Font(fontManager.findfont(self)).family_name
639+
return ft2font.FT2Font(str(fontManager.findfont(self))).family_name
640640

641641
def get_style(self):
642642
"""Return the font style. Values are: normal, italic or oblique.

0 commit comments

Comments
 (0)