Skip to content

Commit

Permalink
reverted ftfont name handling to str
Browse files Browse the repository at this point in the history
svn path=/trunk/matplotlib/; revision=1124
  • Loading branch information
jdh2358 committed Mar 31, 2005
1 parent 9cb670a commit bb3905e
Show file tree
Hide file tree
Showing 18 changed files with 226 additions and 58 deletions.
3 changes: 0 additions & 3 deletions API_CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

Added auto legen capability from sprint -- 'best' is new default

API CHANGES in matplotlib-0.73

Removed deprecated ColormapJet and friends
Expand Down
9 changes: 5 additions & 4 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
New entries should be added at the top

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

2005-03-30 updated /ellipse definition in backend_ps.py to address
bug #1122041 - DSD
2005-03-30 updated /ellipse definition in backend_ps.py to address bug
#1122041 - DSD

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

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

2005-03-28 Added ludal arrow and quiver patch - JDH
2005-03-28 Added Ludal's arrow and quiver patch - JDH

2005-03-28 Added label kwarg to Axes to facilitate forcing the
creation of new Axes with otherwise identical attributes
Expand Down
20 changes: 10 additions & 10 deletions LICENSE/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LICENSE AGREEMENT FOR MATPLOTLIB 0.73.1
LICENSE AGREEMENT FOR MATPLOTLIB 0.74
--------------------------------------

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

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

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

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

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

8. By copying, installing or otherwise using matplotlib 0.73.1,
8. By copying, installing or otherwise using matplotlib 0.74,
Licensee agrees to be bound by the terms and conditions of this License
Agreement.
7 changes: 6 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ examples/backend_driver.py
examples/bar_stacked.py
examples/barchart_demo.py
examples/barh_demo.py
examples/boxplot_demo.py
examples/break.py
examples/color_demo.py
examples/colours.py
Expand Down Expand Up @@ -301,6 +302,7 @@ examples/fill_between_posneg.py
examples/fill_demo.py
examples/fill_spiral.py
examples/finance_demo.py
examples/font_indexing.py
examples/font_table_ttf.py
examples/fonts_demo.py
examples/fonts_demo_kw.py
Expand All @@ -322,6 +324,7 @@ examples/interactive2.py
examples/invert_axes.py
examples/keypress_demo.py
examples/layer_images.py
examples/legend_auto.py
examples/legend_demo.py
examples/legend_demo2.py
examples/line_styles.py
Expand Down Expand Up @@ -355,6 +358,7 @@ examples/printing_in_wx.py
examples/psd_demo.py
examples/pstest.py
examples/pythonic_matplotlib.py
examples/quiver_demo.py
examples/scatter_demo.py
examples/scatter_demo2.py
examples/scatter_profile.py
Expand All @@ -373,6 +377,7 @@ examples/text_themes.py
examples/to_numeric.py
examples/toggle_images.py
examples/two_scales.py
examples/unicode_demo.py
examples/vertical_ticklabels.py
examples/vline_demo.py
examples/webapp_demo.py
Expand Down Expand Up @@ -510,7 +515,6 @@ lib/dateutil/rrule.py
lib/dateutil/tz.py
lib/matplotlib/.cvsignore
lib/matplotlib/__init__.py
lib/matplotlib/__init__.py.~1.45.~
lib/matplotlib/_contour.py
lib/matplotlib/_image.py
lib/matplotlib/_mathtext_data.py
Expand Down Expand Up @@ -538,6 +542,7 @@ lib/matplotlib/mathtext.py
lib/matplotlib/mlab.py
lib/matplotlib/patches.py
lib/matplotlib/pylab.py
lib/matplotlib/pylab.py.orig
lib/matplotlib/pyparsing.py
lib/matplotlib/table.py
lib/matplotlib/text.py
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ clean:


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

Expand Down
21 changes: 11 additions & 10 deletions examples/legend_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,55 @@ def fig_1():
figure(1)
t = arange(0, 40.0 * pi, 0.1)
l, = plot(t, 100*sin(t), 'r', label='sine')
legend()
legend(loc='best')

def fig_2():
figure(2)
plot(x, 'o', label='x=y')
legend()
legend(loc='best')

def fig_3():
figure(3)
plot(x, -x, 'o', label='x= -y')
legend()
legend(loc='best')

def fig_4():
figure(4)
plot(x, ones(len(x)), 'o', label='y=1')
plot(x, -ones(len(x)), 'o', label='y=-1')
legend()
legend(loc='best')

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

def fig_6():
figure(6)
plot(x, 50-x, 'o', label='y=1')
plot(x, x-50, 'o', label='y=-1')
legend()
legend(loc='best')

def fig_7():
figure(7)
xx = x - (N/2.0)
plot(xx, (xx*xx)-1225, 'bo', label='$y=x^2$')
plot(xx, 25*xx, 'go', label='$y=25x$')
plot(xx, -25*xx, 'mo', label='$y=-25x$')
legend()
legend(loc='best')

def fig_8():
figure(8)
b1 = bar(x, x, color='m')
b2 = bar(x, x[::-1], color='g')
legend([b1[0], b2[0]], ['up', 'down'])
legend([b1[0], b2[0]], ['up', 'down'], loc='best')

def fig_9():
figure(9)
b1 = bar(x, -x)
b2 = bar(x, -x[::-1], color='r')
legend([b1[0], b2[0]], ['down', 'up'])
legend([b1[0], b2[0]], ['down', 'up'], loc='best')

def fig_10():
figure(10)
Expand All @@ -74,7 +74,8 @@ def fig_10():
b3 = bar(x, -x, bottom=100)
b4 = bar(x, -x[::-1], bottom=100, color='r')
legend([b1[0], b2[0], b3[0], b4[0]], ['bottom right', 'bottom left',
'top left', 'top right'])
'top left', 'top right'],
loc='best')

if __name__ == '__main__':
nfigs = 10
Expand Down
3 changes: 2 additions & 1 deletion examples/unicode_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xlabel( unicode("réactivité nous permettent d'être sélectionnés et adoptés", 'latin-1') )
ylabel( unicode('Andr\xc3\xa9 was here!', 'utf-8') )
text( 0.5, 2.5, unicode('Institut für Festkörperphysik', 'latin-1'), rotation=45)
text( 2, 2.5, u'AVA')
text( 1, 1.5, u'AVA (check kerning)')

savefig('test.ps')
show()
2 changes: 1 addition & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"""
from __future__ import generators

__version__ = '0.73.1'
__version__ = '0.74'
__revision__ = '$Revision$'
__date__ = '$Date$'

Expand Down
6 changes: 4 additions & 2 deletions lib/matplotlib/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3351,12 +3351,14 @@ def connect(self, s, func):
func(ax) # where ax is the instance making the callback.
The following events can be connected to: %s
The following events can be connected to:
'xlim_changed','ylim_changed'
The connection id is is returned - you can use this with
disconnect to disconnect from the axes event
""" % ', '.join(Axes._events)
"""

if s not in Axes._events:
raise ValueError('You can only connect to the following axes events: %s' % ', '.join(Axes._events))
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def _get_agg_font(self, prop):

if font is None:
fname = fontManager.findfont(prop)
font = FT2Font(fname)
font = FT2Font(str(fname))
_fontd[key] = font

font.clear()
Expand Down
15 changes: 10 additions & 5 deletions lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def _get_font_ttf(self, prop):
font = _fontd.get(key)
if font is None:
fname = fontManager.findfont(prop)
font = FT2Font(fname)
font = FT2Font(str(fname))
_fontd[key] = font
if fname not in _type42:
_type42.append(fname)
Expand Down Expand Up @@ -491,10 +491,15 @@ def draw_unicode(self, gc, x, y, s, prop, angle):
thisx, thisy = 0,0
for c in s:
ccode = ord(c)
gind = glyphd[ccode]
gind = glyphd.get(ccode)
if gind is None:
ccode = ord('?')
name = '.notdef'
gind = 0
else:
name = font.get_glyph_name(gind)
glyph = font.load_char(ccode)

name = font.get_glyph_name(gind)
if lastgind is not None:
kern = font.get_kerning(lastgind, gind, KERNING_UNFITTED)
else:
Expand Down Expand Up @@ -598,7 +603,7 @@ def encodeTTFasPS(fontfile):
data = font.read(65520)

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

headtab = font.get_sfnt_table('head')
version = '%d.%d' % headtab['version']
Expand Down Expand Up @@ -773,7 +778,7 @@ def print_figure(self, outfile, dpi=72,
print >>fh, l.strip()
if not rcParams['ps.useafm']:
for font in type42:
print >>fh, "%%BeginFont: "+FT2Font(font).postscript_name
print >>fh, "%%BeginFont: "+FT2Font(str(font)).postscript_name
print >>fh, encodeTTFasPS(font)
print >>fh, "%%EndFont"
print >>fh, "%%EndProlog"
Expand Down
10 changes: 6 additions & 4 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,12 @@ def get_verts(self):
offsets = [(0,0)]
else:
offsets = self._offsets
N = max(len(offsets), len(self._verts))
Noffsets = len(offsets)
Nsegments = len(self._segments)
vertsall = []
for i in range(N):
ox, oy = offsets[i%N]
verts = self._segments[i%N]
for i in range(max(Noffsets, Nsegments)):
#print i, N, i%N, len(offsets)
ox, oy = offsets[i%Noffsets]
verts = self._segments[i%Nsegments]
vertsall.extend([(x+ox, y+oy) for x,y in verts])
return vertsall
4 changes: 2 additions & 2 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def createFontDict(fontfiles, fontext='ttf'):
prop = afmFontProperty(font)
else:
try:
font = ft2font.FT2Font(fpath)
font = ft2font.FT2Font(str(fpath))
except RuntimeError:
warnings.warn("Could not open font file %s"%fpath)
continue
Expand Down Expand Up @@ -636,7 +636,7 @@ def get_name(self):
"""Return the name of the font that best matches the font
properties.
"""
return ft2font.FT2Font(fontManager.findfont(self)).family_name
return ft2font.FT2Font(str(fontManager.findfont(self))).family_name

def get_style(self):
"""Return the font style. Values are: normal, italic or oblique.
Expand Down
Loading

0 comments on commit bb3905e

Please sign in to comment.