You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
(16) |
2
(7) |
3
(4) |
4
|
5
|
6
(4) |
7
(5) |
8
(6) |
9
(7) |
10
(4) |
11
|
12
(2) |
13
(5) |
14
(3) |
15
|
16
(5) |
17
(1) |
18
|
19
|
20
(5) |
21
(7) |
22
(3) |
23
(5) |
24
(1) |
25
|
26
|
27
(6) |
28
(7) |
29
(3) |
30
(8) |
31
(6) |
|
Revision: 3662 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3662&view=rev Author: mdboom Date: 2007年08月01日 10:28:58 -0700 (2007年8月01日) Log Message: ----------- Convert _ttconv.cpp to use raw Python/C API, rather than CXX. Modified Paths: -------------- trunk/matplotlib/src/_ttconv.cpp Modified: trunk/matplotlib/src/_ttconv.cpp =================================================================== --- trunk/matplotlib/src/_ttconv.cpp 2007年08月01日 16:21:11 UTC (rev 3661) +++ trunk/matplotlib/src/_ttconv.cpp 2007年08月01日 17:28:58 UTC (rev 3662) @@ -1,181 +1,204 @@ -#include "CXX/Extensions.hxx" -#include "CXX/Objects.hxx" -#include "ttconv/pprdrv.h" +/* + _ttconv.c -class ttconv_module : public Py::ExtensionModule<ttconv_module> -{ -public: - ttconv_module() - : Py::ExtensionModule<ttconv_module>( "ttconv" ) - { - add_varargs_method("convert_ttf_to_ps", - &ttconv_module::convert_ttf_to_ps, - ttconv_module::convert_ttf_to_ps__doc__); - add_varargs_method("get_pdf_charprocs", - &ttconv_module::get_pdf_charprocs, - ttconv_module::get_pdf_charprocs__doc__); + Python wrapper for TrueType conversion library in ../ttconv. + */ - initialize( "The ttconv module" ); - } +#include <Python.h> +#include "ttconv/pprdrv.h" +#include <vector> - Py::Object - convert_ttf_to_ps(const Py::Tuple& args); - static char convert_ttf_to_ps__doc__[]; - - Py::Object - get_pdf_charprocs(const Py::Tuple& args); - static char get_pdf_charprocs__doc__[]; -}; - -char ttconv_module::convert_ttf_to_ps__doc__[] = -"convert_ttf_to_ps(filename, output, fonttype, glyph_ids)\n" -"\n" -"Converts the Truetype font into a Type 3 or Type 42 Postscript font, " -"optionally subsetting the font to only the desired set of characters.\n" -"\n" -"filename is the path to a TTF font file.\n" -"output is a Python file-like object with a write method that the Postscript " -"font data will be written to.\n" -"fonttype may be either 3 or 42. Type 3 is a \"raw Postscript\" font. " -"Type 42 is an embedded Truetype font. Glyph subsetting is not supported " -"for Type 42 fonts.\n" -"glyph_ids (optional) is a list of glyph ids (integers) to keep when " -"subsetting to a Type 3 font. If glyph_ids is not provided or is None, " -"then all glyphs will be included. If any of the glyphs specified are " -"composite glyphs, then the component glyphs will also be included." -; - /** * An implementation of TTStreamWriter that writes to a Python * file-like object. */ class PythonFileWriter : public TTStreamWriter { - Py::Callable _write_method; + PyObject* _write_method; public: - PythonFileWriter(const Py::Object& file_like_object) { - _write_method = file_like_object.getAttr( "write" ); + PythonFileWriter() { + _write_method = NULL; } + ~PythonFileWriter() { + if (_write_method) + Py_DECREF(_write_method); + } + + void set(PyObject* write_method) { + if (_write_method) + Py_DECREF(_write_method); + _write_method = write_method; + if (_write_method) + Py_INCREF(_write_method); + } + virtual void write(const char* a) { - Py::Tuple args(1); - args[0] = Py::String(a); - _write_method.apply(args); + if (_write_method) + PyObject_CallFunction(_write_method, "s", a); } }; -Py::Object -ttconv_module::convert_ttf_to_ps(const Py::Tuple & args) { - args.verify_length(3, 4); +int fileobject_to_PythonFileWriter(PyObject* object, void* address) { + PythonFileWriter* file_writer = (PythonFileWriter*)address; + PyObject* write_method = PyObject_GetAttrString(object, "write"); + if (write_method == NULL || ! PyCallable_Check(write_method)) { + PyErr_SetString(PyExc_TypeError, "Expected a file-like object with a write method."); + return 0; + } + file_writer->set(write_method); + return 1; +} - std::string fname = Py::String(args[0]).as_std_string(); +int pyiterable_to_vector_int(PyObject* object, void* address) { + std::vector<int>* result = (std::vector<int>*)address; + PyObject* iterator = PyObject_GetIter(object); + if (! iterator) + return 0; + PyObject* item; + while (item = PyIter_Next(iterator)) { + long value = PyInt_AsLong(item); + if (value == -1 && PyErr_Occurred()) + return 0; + result->push_back(value); + } + return 1; +} - PythonFileWriter python_file_writer(args[1]); +static PyObject* +convert_ttf_to_ps(PyObject* self, PyObject* args, PyObject* kwds) { + const char* filename; + PythonFileWriter output; + int fonttype; + std::vector<int> glyph_ids; - long font_type = (long)Py::Int(args[2]); - if ( font_type != 3 && font_type != 42 ) { - throw Py::ValueError("Font type must be either 3 (raw Postscript) or 42 (embedded Truetype)"); + static char *kwlist[] = { "filename", "output", "fonttype", "glyph_ids", NULL }; + if (! PyArg_ParseTupleAndKeywords + (args, kwds, + "sO&i|O&:convert_ttf_to_ps", kwlist, + &filename, + fileobject_to_PythonFileWriter, + &output, + &fonttype, + pyiterable_to_vector_int, + &glyph_ids)) + return NULL; + + if (fonttype != 3 && fonttype != 42) { + PyErr_SetString(PyExc_ValueError, + "fonttype must be either 3 (raw Postscript) or 42 " + "(embedded Truetype)"); + return NULL; } - std::vector<int> glyph_ids; - if ( args.size() == 4 ) { - if ( args[3] != Py::None() ) { - Py::SeqBase< Py::Int > py_glyph_ids = args[3]; - size_t num_glyphs = py_glyph_ids.size(); - // If there are no included glyphs, just return - if (num_glyphs == 0) { - return Py::Object(); - } - glyph_ids.reserve(num_glyphs); - for (size_t i = 0; i < num_glyphs; ++i) { - glyph_ids.push_back( (long) py_glyph_ids.getItem(i) ); - } - } - } - try { - insert_ttfont( fname.c_str(), python_file_writer, (font_type_enum) font_type, glyph_ids ); + insert_ttfont( filename, output, (font_type_enum)fonttype, glyph_ids ); } catch (TTException& e) { - throw Py::RuntimeError(e.getMessage()); + PyErr_SetString(PyExc_RuntimeError, e.getMessage()); + return NULL; + } catch (...) { + PyErr_SetString(PyExc_RuntimeError, "Unknown C++ exception"); + return NULL; } - return Py::Object(); + Py_INCREF(Py_None); + return Py_None; } -char ttconv_module::get_pdf_charprocs__doc__[] = -"get_pdf_charprocs(filename, glyph_ids)\n" -"\n" -"Given a Truetype font file, returns a dictionary containing the PDF Type 3\n" -"representation of its path. Useful for subsetting a Truetype font inside\n" -"of a PDF file.\n" -"\n" -"filename is the path to a TTF font file.\n" -"glyph_ids is a list of the numeric glyph ids to include.\n" -"The return value is a dictionary where the keys are glyph names and \n" -"the values are the stream content needed to render that glyph. This\n" -"is useful to generate the CharProcs dictionary in a PDF Type 3 font.\n" -; - -/** - * An implementation of TTStreamWriter that writes to a Python - * file-like object. - */ class PythonDictionaryCallback : public TTDictionaryCallback { - Py::Dict _dict; + PyObject* _dict; public: - PythonDictionaryCallback(const Py::Dict& dict) : _dict(dict) { - + PythonDictionaryCallback(PyObject* dict) { + _dict = dict; } virtual void add_pair(const char* a, const char* b) { - _dict.setItem(a, Py::String(b)); + PyObject* value = PyString_FromString(b); + if (value) + PyDict_SetItemString(_dict, a, value); } }; -Py::Object -ttconv_module::get_pdf_charprocs(const Py::Tuple & args) { - args.verify_length(1, 2); +static PyObject* +py_get_pdf_charprocs(PyObject* self, PyObject* args, PyObject* kwds) { + const char* filename; + std::vector<int> glyph_ids; + PyObject* result; - Py::Dict result; + static char *kwlist[] = { "filename", "glyph_ids", NULL }; + if (! PyArg_ParseTupleAndKeywords + (args, kwds, + "s|O&:convert_ttf_to_ps", kwlist, + &filename, + pyiterable_to_vector_int, + &glyph_ids)) + return NULL; - std::string fname = Py::String(args[0]).as_std_string(); + result = PyDict_New(); + if (!result) + return NULL; - std::vector<int> glyph_ids; - if ( args.size() == 2 ) { - if ( args[1] != Py::None() ) { - Py::SeqBase< Py::Int > py_glyph_ids = args[1]; - size_t num_glyphs = py_glyph_ids.size(); - // If there are no included glyphs, just return - if (num_glyphs == 0) { - return result; - } - glyph_ids.reserve(num_glyphs); - for (size_t i = 0; i < num_glyphs; ++i) { - glyph_ids.push_back( (long) py_glyph_ids.getItem(i) ); - } - } - } + PythonDictionaryCallback dict(result); - PythonDictionaryCallback dictCallback(result); - try { - ::get_pdf_charprocs( fname.c_str(), glyph_ids, dictCallback ); + ::get_pdf_charprocs( filename, glyph_ids, dict ); } catch (TTException& e) { - throw Py::RuntimeError(e.getMessage()); + PyErr_SetString(PyExc_RuntimeError, e.getMessage()); + return NULL; + } catch (...) { + PyErr_SetString(PyExc_RuntimeError, "Unknown C++ exception"); + return NULL; } return result; } -#if defined(_MSC_VER) -DL_EXPORT(void) -#elif defined(__cplusplus) - extern "C" void -#else -void +static PyMethodDef ttconv_methods[] = { + {"convert_ttf_to_ps", (PyCFunction)convert_ttf_to_ps, METH_KEYWORDS, + "convert_ttf_to_ps(filename, output, fonttype, glyph_ids)\n" + "\n" + "Converts the Truetype font into a Type 3 or Type 42 Postscript font, " + "optionally subsetting the font to only the desired set of characters.\n" + "\n" + "filename is the path to a TTF font file.\n" + "output is a Python file-like object with a write method that the Postscript " + "font data will be written to.\n" + "fonttype may be either 3 or 42. Type 3 is a \"raw Postscript\" font. " + "Type 42 is an embedded Truetype font. Glyph subsetting is not supported " + "for Type 42 fonts.\n" + "glyph_ids (optional) is a list of glyph ids (integers) to keep when " + "subsetting to a Type 3 font. If glyph_ids is not provided or is None, " + "then all glyphs will be included. If any of the glyphs specified are " + "composite glyphs, then the component glyphs will also be included." + }, + {"get_pdf_charprocs", (PyCFunction)py_get_pdf_charprocs, METH_KEYWORDS, + "get_pdf_charprocs(filename, glyph_ids)\n" + "\n" + "Given a Truetype font file, returns a dictionary containing the PDF Type 3\n" + "representation of its path. Useful for subsetting a Truetype font inside\n" + "of a PDF file.\n" + "\n" + "filename is the path to a TTF font file.\n" + "glyph_ids is a list of the numeric glyph ids to include.\n" + "The return value is a dictionary where the keys are glyph names and \n" + "the values are the stream content needed to render that glyph. This\n" + "is useful to generate the CharProcs dictionary in a PDF Type 3 font.\n" + }, + {NULL} /* Sentinel */ +}; + +#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ +#define PyMODINIT_FUNC void #endif -initttconv(void) +PyMODINIT_FUNC +initttconv(void) { - static ttconv_module* ttconv = new ttconv_module; + PyObject* m; + + m = Py_InitModule3("ttconv", ttconv_methods, + "Module to handle converting and subsetting TrueType " + "fonts to Postscript Type 3, Postscript Type 42 and " + "Pdf Type 3 fonts."); } + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3660 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3660&view=rev Author: mdboom Date: 2007年08月01日 08:56:34 -0700 (2007年8月01日) Log Message: ----------- Fix some win32 differences Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 15:35:54 UTC (rev 3659) +++ trunk/matplotlib/setupext.py 2007年08月01日 15:56:34 UTC (rev 3660) @@ -358,7 +358,8 @@ def add_ft2font_flags(module): 'Add the module flags to ft2font extension' if not get_pkgconfig(module, 'freetype2'): - module.libraries.append('freetype') + module.libraries.extend(['freetype', 'z']) + add_base_flags(module) basedirs = module.include_dirs[:] # copy the list to avoid inf loop! for d in basedirs: @@ -372,9 +373,8 @@ for d in basedirs: p = os.path.join(d, 'freetype2/lib') if os.path.exists(p): module.library_dirs.append(p) - - module.libraries.append('z') - add_base_flags(module) + else: + add_base_flags(module) if sys.platform == 'win32' and win32_compiler == 'mingw32': module.libraries.append('gw32c') @@ -451,10 +451,38 @@ 'C:/GTK/include/gtk', ]) - add_base_flags(module) + add_base_flags(module) + + if not os.environ.has_key('PKG_CONFIG_PATH'): + # If Gtk+ is installed, pkg-config is required to be installed + os.environ['PKG_CONFIG_PATH'] = 'C:\GTK\lib\pkgconfig' + + pygtkIncludes = getoutput('pkg-config --cflags-only-I pygtk-2.0').split() + gtkIncludes = getoutput('pkg-config --cflags-only-I gtk+-2.0').split() + includes = pygtkIncludes + gtkIncludes + module.include_dirs.extend([include[2:] for include in includes]) + + pygtkLinker = getoutput('pkg-config --libs pygtk-2.0').split() + gtkLinker = getoutput('pkg-config --libs gtk+-2.0').split() + linkerFlags = pygtkLinker + gtkLinker + + module.libraries.extend( + [flag[2:] for flag in linkerFlags if flag.startswith('-l')]) + + module.library_dirs.extend( + [flag[2:] for flag in linkerFlags if flag.startswith('-L')]) + + module.extra_link_args.extend( + [flag for flag in linkerFlags if not + (flag.startswith('-l') or flag.startswith('-L'))]) + # visual studio doesn't need the math library + if sys.platform == 'win32' and win32_compiler == 'msvc' and 'm' in module.libraries: + module.libraries.remove('m') + if sys.platform != 'win32': # If Gtk+ is installed, pkg-config is required to be installed + add_base_flags(module) get_pkgconfig(module, 'pygtk-2.0 gtk+-2.0') # visual studio doesn't need the math library This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3661 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3661&view=rev Author: mdboom Date: 2007年08月01日 09:21:11 -0700 (2007年8月01日) Log Message: ----------- Only display the raw version (not the SVN revision, which only refers to one file and is basically wrong.) Modified Paths: -------------- trunk/matplotlib/setup.py Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007年08月01日 15:56:34 UTC (rev 3660) +++ trunk/matplotlib/setup.py 2007年08月01日 16:21:11 UTC (rev 3661) @@ -108,14 +108,12 @@ BUILD_NXUTILS = 1 for line in file('lib/matplotlib/__init__.py').readlines(): - if (line.startswith('__version__') or - line.startswith('__revision__') or - line.startswith('__date__')): + if (line.startswith('__version__')): exec(line.strip()) print_line() print_raw("BUILDING MATPLOTLIB") -print_status('matplotlib', '%s (r%s)' % (__version__, __revision__.split()[-2])) +print_status('matplotlib', __version__) print_status('python', sys.version) print_status('platform', sys.platform) if sys.platform == 'win32': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3659 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3659&view=rev Author: mdboom Date: 2007年08月01日 08:35:54 -0700 (2007年8月01日) Log Message: ----------- Use numpy.inf Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007年08月01日 15:07:29 UTC (rev 3658) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007年08月01日 15:35:54 UTC (rev 3659) @@ -135,6 +135,7 @@ from sets import Set from unicodedata import category from warnings import warn +import numpy from matplotlib import verbose from matplotlib.pyparsing import Literal, Word, OneOrMore, ZeroOrMore, \ @@ -607,7 +608,11 @@ r'\backslash': [('cal', '\x6e'), ('ex', '\xb2'), ('ex', '\x2f'), ('ex', '\xc2'), ('ex', '\x2d')], r'/' : [('rm', '/'), ('ex', '\xb1'), ('ex', '\x2e'), - ('ex', '\xcb'), ('ex', '\x2c')] + ('ex', '\xcb'), ('ex', '\x2c')], + r'\widehat' : [('rm', '\x5e'), ('ex', '\x62'), ('ex', '\x63'), + ('ex', '\x64')], + r'\widetilde': [('rm', '\x7e'), ('ex', '\x65'), ('ex', '\x66'), + ('ex', '\x67')] } for alias, target in [('\leftparen', '('), @@ -1162,7 +1167,7 @@ List.__init__(self, elements) self.vpack() - def vpack(self, h=0., m='additional', l=float('inf')): + def vpack(self, h=0., m='additional', l=float(numpy.inf)): """The main duty of vpack is to compute the dimensions of the resulting boxes, and to adjust the glue if one of those dimensions is pre-specified. @@ -1395,7 +1400,7 @@ self.super = None Hlist.__init__(self, []) -class AutoSizedDelim(Hlist): +class AutoHeightChar(Hlist): """A class that will create a character as close to the given height and depth as possible. When using a font with multiple height versions of some characters (such as the BaKoMa fonts), the correct glyph will @@ -1425,6 +1430,34 @@ shift = (depth - char.depth) Hlist.__init__(self, [char]) self.shift_amount = shift + +class AutoWidthChar(Hlist): + """A class that will create a character as close to the given width + as possible. When using a font with multiple width versions + of some characters (such as the BaKoMa fonts), the correct glyph will + be selected, otherwise this will always just return a scaled version + of the glyph.""" + def __init__(self, c, width, state, always=False): + alternatives = state.font_output.get_sized_alternatives_for_symbol( + state.font, c) + + state = state.copy() + big_enough = False + for fontname, sym in alternatives: + state.font = fontname + char = Char(sym, state) + if char.width > width: + big_enough = True + break + + # If the largest option is still not big enough, just do + # simple scale on it. + if not big_enough: + factor = width / char.width + state.fontsize *= factor + char = Char(sym, state) + + Hlist.__init__(self, [char]) class Ship(object): """Once the boxes have been set up, this sends them to output. @@ -1653,7 +1686,7 @@ bslash = Literal('\\') accent = oneOf("hat check dot breve acute ddot grave tilde bar " - "vec \" ` ' ~ . ^") + "vec \" ` ' ~ . ^ widehat widetilde") function = oneOf("arccos csc ker min arcsin deg lg Pr arctan det " "lim sec arg dim liminf sin cos exp limsup sinh " @@ -1920,8 +1953,10 @@ r"\'" : r'\combiningacuteaccent', r'\~' : r'\combiningtilde', r'\.' : r'\combiningdotabove', - r'\^' : r'\circumflexaccent', + r'\^' : r'\circumflexaccent' } + + _wide_accents = Set(r"\widehat \widetilde".split()) def accent(self, s, loc, toks): assert(len(toks)==1) @@ -1931,7 +1966,10 @@ if len(toks[0]) != 2: raise ParseFatalException("Error parsing accent") accent, sym = toks[0] - accent = Accent(self._accent_map[accent], self.get_state()) + if accent in self._wide_accents: + accent = AutoWidthChar(accent, sym.width, state) + else: + accent = Accent(self._accent_map[accent], state) centered = HCentered([accent]) centered.hpack(sym.width, 'exactly') centered.shift_amount = accent._metrics.xmin @@ -2154,7 +2192,7 @@ # the height so it doesn't seem cramped height = body.height - body.shift_amount + thickness * 5.0 depth = body.depth + body.shift_amount - check = AutoSizedDelim(r'\sqrt', height, depth, state, always=True) + check = AutoHeightChar(r'\sqrt', height, depth, state, always=True) height = check.height - check.shift_amount depth = check.depth + check.shift_amount @@ -2190,10 +2228,10 @@ parts = [] # \left. and \right. aren't supposed to produce any symbols if front != '.': - parts.append(AutoSizedDelim(front, height, depth, state)) + parts.append(AutoHeightChar(front, height, depth, state)) parts.extend(middle.asList()) if back != '.': - parts.append(AutoSizedDelim(back, height, depth, state)) + parts.append(AutoHeightChar(back, height, depth, state)) hlist = Hlist(parts) return hlist This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3658 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3658&view=rev Author: mdboom Date: 2007年08月01日 08:07:29 -0700 (2007年8月01日) Log Message: ----------- Change "unknown (no pkg-config)" to "found, but unknown version (no pkg-config)" Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 15:06:29 UTC (rev 3657) +++ trunk/matplotlib/setupext.py 2007年08月01日 15:07:29 UTC (rev 3658) @@ -212,7 +212,7 @@ return False def get_pkgconfig_version(package): - default = "unknown (no pkg-config)" + default = "found, but unknown version (no pkg-config)" if not has_pkgconfig(): return default This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3657 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3657&view=rev Author: mdboom Date: 2007年08月01日 08:06:29 -0700 (2007年8月01日) Log Message: ----------- Fix erroneous message when wxPython devel headers are not even needed. Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 14:22:16 UTC (rev 3656) +++ trunk/matplotlib/setupext.py 2007年08月01日 15:06:29 UTC (rev 3657) @@ -373,7 +373,7 @@ p = os.path.join(d, 'freetype2/lib') if os.path.exists(p): module.library_dirs.append(p) - module.libraries.append('z') + module.libraries.append('z') add_base_flags(module) if sys.platform == 'win32' and win32_compiler == 'mingw32': @@ -470,7 +470,10 @@ except ImportError: explanation = 'wxPython not found' else: - if sys.platform == 'win32' and win32_compiler == 'mingw32': + if getattr(wx, '__version__', '0.0')[0:3] >= '2.8': + print_status("wxPython", wx.__version__) + return True + elif sys.platform == 'win32' and win32_compiler == 'mingw32': explanation = "The wxAgg extension can not be built using the mingw32 compiler on Windows, since the default wxPython binary is built using MS Visual Studio" else: wxconfig = find_wx_config() @@ -491,15 +494,14 @@ gotit = True if gotit: - if getattr(wx, '__version__', '0.0')[0:3] < '2.8': - module = Extension("test", []) - add_wx_flags(module, wxconfig) - if not find_include_file( - module.include_dirs, - os.path.join("wx", "wxPython", "wxPython.h")): - explanation = ("Could not find wxPython headers in any of %s" % + module = Extension("test", []) + add_wx_flags(module, wxconfig) + if not find_include_file( + module.include_dirs, + os.path.join("wx", "wxPython", "wxPython.h")): + explanation = ("Could not find wxPython headers in any of %s" % ", ".join(["'%s'" % x for x in module.include_dirs])) - gotit = False + gotit = False if gotit: print_status("wxPython", wx.__version__) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3656 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3656&view=rev Author: mdboom Date: 2007年08月01日 07:22:16 -0700 (2007年8月01日) Log Message: ----------- Fix order of libraries between freetype2 and zlib Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 14:08:44 UTC (rev 3655) +++ trunk/matplotlib/setupext.py 2007年08月01日 14:22:16 UTC (rev 3656) @@ -357,9 +357,6 @@ def add_ft2font_flags(module): 'Add the module flags to ft2font extension' - module.libraries.append('z') - add_base_flags(module) - if not get_pkgconfig(module, 'freetype2'): module.libraries.append('freetype') @@ -376,6 +373,9 @@ p = os.path.join(d, 'freetype2/lib') if os.path.exists(p): module.library_dirs.append(p) + module.libraries.append('z') + add_base_flags(module) + if sys.platform == 'win32' and win32_compiler == 'mingw32': module.libraries.append('gw32c') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3655 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3655&view=rev Author: mdboom Date: 2007年08月01日 07:08:44 -0700 (2007年8月01日) Log Message: ----------- Fix formatting display bug. Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 13:51:48 UTC (rev 3654) +++ trunk/matplotlib/setupext.py 2007年08月01日 14:08:44 UTC (rev 3655) @@ -114,13 +114,13 @@ def print_status(package, status): initial_indent = "%22s: " % package indent = ' ' * 24 - print fill(status, width=76, + print fill(str(status), width=76, initial_indent=initial_indent, subsequent_indent=indent) def print_message(message): indent = ' ' * 24 + "* " - print fill(message, width=76, + print fill(str(message), width=76, initial_indent=indent, subsequent_indent=indent) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3654 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3654&view=rev Author: mdboom Date: 2007年08月01日 06:51:48 -0700 (2007年8月01日) Log Message: ----------- Use Python lists rather than linked lists to improve speed Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007年08月01日 13:06:07 UTC (rev 3653) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007年08月01日 13:51:48 UTC (rev 3654) @@ -850,30 +850,26 @@ # Percentage of x-height of additional horiz. space after sub/superscripts SCRIPT_SPACE = 0.3 # Percentage of x-height that sub/superscripts drop below the baseline -SUBDROP = 0.4 +SUBDROP = 0.3 # Percentage of x-height that superscripts drop below the baseline SUP1 = 0.7 # Percentage of x-height that subscripts drop below the baseline SUB1 = 0.0 # Percentage of x-height that superscripts are offset relative to the subscript -DELTA = 0.1 +DELTA = 0.25 class MathTextWarning(Warning): pass class Node(object): - """A node in a linked list. + """A node in the TeX box model @133 """ def __init__(self): - self.link = None self.size = 0 def __repr__(self): - s = self.__internal_repr__() - if self.link: - s += ' ' + self.link.__repr__() - return s + return self.__internal_repr__() def __internal_repr__(self): return self.__class__.__name__ @@ -881,21 +877,14 @@ def get_kerning(self, next): return 0.0 - def set_link(self, other): - self.link = other - def shrink(self): """Shrinks one level smaller. There are only three levels of sizes, after which things will no longer get smaller.""" - if self.link: - self.link.shrink() self.size += 1 def grow(self): """Grows one level larger. There is no limit to how big something can get.""" - if self.link: - self.link.grow() self.size -= 1 def render(self, x, y): @@ -1027,29 +1016,17 @@ def __init__(self, elements): Box.__init__(self, 0., 0., 0.) self.shift_amount = 0. # An arbitrary offset - self.list_head = None # The head of a linked list of Nodes in this box + self.children = elements # The child nodes of this list # The following parameters are set in the vpack and hpack functions self.glue_set = 0. # The glue setting of this list self.glue_sign = 0 # 0: normal, -1: shrinking, 1: stretching self.glue_order = 0 # The order of infinity (0 - 3) for the glue - - # Convert the Python list to a linked list - if len(elements): - elem = self.list_head = elements[0] - for next in elements[1:]: - elem.set_link(next) - elem = next def __repr__(self): - s = '[%s <%d %d %d %d> ' % (self.__internal_repr__(), - self.width, self.height, - self.depth, self.shift_amount) - if self.list_head: - s += ' ' + self.list_head.__repr__() - s += ']' - if self.link: - s += ' ' + self.link.__repr__() - return s + return '[%s <%d %d %d %d> %s]' % (self.__internal_repr__(), + self.width, self.height, + self.depth, self.shift_amount, + ' '.join(self.children)) def _determine_order(self, totals): """A helper function to determine the highest order of glue @@ -1071,21 +1048,21 @@ self.glue_sign = 0 self.glue_ratio = 0. if o == 0: - if self.list_head is not None: + if len(self.children): warn("%s %s: %r" % (error_type, self.__class__.__name__, self), MathTextWarning) def shrink(self): - if self.list_head: - self.list_head.shrink() + for child in self.children: + child.shrink() Box.shrink(self) if self.size < NUM_SIZE_LEVELS: self.shift_amount *= SHRINK_FACTOR self.glue_set *= SHRINK_FACTOR def grow(self): - if self.list_head: - self.list_head.grow() + for child in self.children: + child.grow() Box.grow(self) self.shift_amount *= INV_SHRINK_FACTOR self.glue_set *= INV_SHRINK_FACTOR @@ -1103,15 +1080,21 @@ Chars themselves determine the amount of kerning they need (in get_kerning), and this function just creates the linked list in the correct way.""" - elem = self.list_head - while elem is not None: - next = elem.link + new_children = [] + num_children = len(self.children) + for i in range(num_children): + elem = self.children[i] + if i < num_children - 1: + next = self.children[i + 1] + else: + next = None + + new_children.append(elem) kerning_distance = elem.get_kerning(next) if kerning_distance != 0.: kern = Kern(kerning_distance) - elem.link = kern - kern.link = next - elem = next + new_children.append(kern) + self.children = new_children def hpack(self, w=0., m='additional'): """The main duty of hpack is to compute the dimensions of the @@ -1136,18 +1119,12 @@ x = 0. total_stretch = [0.] * 4 total_shrink = [0.] * 4 - p = self.list_head - while p is not None: - # Layout characters in a tight inner loop (common case) - while isinstance(p, Char): + for p in self.children: + if isinstance(p, Char): x += p.width h = max(h, p.height) d = max(d, p.depth) - p = p.link # Go to next node in list - if p is None: - break - - if isinstance(p, Box): + elif isinstance(p, Box): x += p.width if p.height is not None and p.depth is not None: s = getattr(p, 'shift_amount', 0.) @@ -1160,7 +1137,6 @@ total_shrink[glue_spec.shrink_order] += glue_spec.shrink elif isinstance(p, Kern): x += p.width - p = p.link # Go to next node in list self.height = h self.depth = d @@ -1207,11 +1183,8 @@ x = 0. total_stretch = [0.] * 4 total_shrink = [0.] * 4 - p = self.list_head - while p is not None: - if isinstance(p, Char): - raise RuntimeError("Internal mathtext error: Char node found in Vlist.") - elif isinstance(p, Box): + for p in self.children: + if isinstance(p, Box): x += d + p.height d = p.depth if p.width is not None: @@ -1227,8 +1200,9 @@ elif isinstance(p, Kern): x += d + p.width d = 0. - p = p.link - + elif isinstance(p, Char): + raise RuntimeError("Internal mathtext error: Char node found in Vlist.") + self.width = w if d > l: x += d - l @@ -1482,23 +1456,18 @@ cur_glue = 0. glue_order = box.glue_order glue_sign = box.glue_sign - p = box.list_head base_line = self.cur_v left_edge = self.cur_h self.cur_s += 1 self.max_push = max(self.cur_s, self.max_push) - while p: - while isinstance(p, Char): + for p in box.children: + if isinstance(p, Char): p.render(self.cur_h + self.off_h, self.cur_v + self.off_v) self.cur_h += p.width - p = p.link - if p is None: - break - - if isinstance(p, List): + elif isinstance(p, List): # @623 - if p.list_head is None: + if len(p.children) == 0: self.cur_h += p.width else: edge = self.cur_h @@ -1542,7 +1511,6 @@ self.cur_h += rule_width elif isinstance(p, Kern): self.cur_h += p.width - p = p.link self.cur_s -= 1 def vlist_out(self, box): @@ -1550,18 +1518,15 @@ cur_glue = 0. glue_order = box.glue_order glue_sign = box.glue_sign - p = box.list_head self.cur_s += 1 self.max_push = max(self.max_push, self.cur_s) left_edge = self.cur_h self.cur_v -= box.height top_edge = self.cur_v - while p: - if isinstance(p, Char): - raise RuntimeError("Internal mathtext error: Char node found in vlist") - elif isinstance(p, List): - if p.list_head is None: + for p in box.children: + if isinstance(p, List): + if len(p.children) == 0: self.cur_v += p.height + p.depth else: self.cur_v += p.height @@ -1601,8 +1566,8 @@ self.cur_v += rule_height elif isinstance(p, Kern): self.cur_v += p.width - - p = p.link + elif isinstance(p, Char): + raise RuntimeError("Internal mathtext error: Char node found in vlist") self.cur_s -= 1 ship = Ship() @@ -1657,7 +1622,7 @@ _punctuation_symbols = Set(r', ; . ! \ldotp \cdotp'.split()) _overunder_symbols = Set(r''' - \sum \prod \int \coprod \oint \bigcap \bigcup \bigsqcup \bigvee + \sum \prod \coprod \bigcap \bigcup \bigsqcup \bigvee \bigwedge \bigodot \bigotimes \bigoplus \biguplus '''.split() ) @@ -1665,6 +1630,8 @@ _overunder_functions = Set( r"lim liminf limsup sup max min".split() ) + + _dropsub_symbols = Set(r'''\int \oint'''.split()) def __init__(self): # All forward declarations are here @@ -1843,6 +1810,7 @@ def clear(self): self._expr = None self._state_stack = None + self._em_width_cache = {} def parse(self, s, fonts_object, fontsize, dpi): self._state_stack = [self.State(fonts_object, 'default', fontsize, dpi)] @@ -1898,10 +1866,14 @@ def _make_space(self, percentage): # All spaces are relative to em width state = self.get_state() - metrics = state.font_output.get_metrics( - state.font, 'm', state.fontsize, state.dpi) - em = metrics.advance - return Kern(em * percentage) + key = (state.font, state.fontsize, state.dpi) + width = self._em_width_cache.get(key) + if width is None: + metrics = state.font_output.get_metrics( + state.font, 'm', state.fontsize, state.dpi) + width = metrics.advance + self._em_width_cache[key] = width + return Kern(width * percentage) _space_widths = { r'\ ' : 0.3, r',円' : 0.4, @@ -1919,17 +1891,19 @@ def symbol(self, s, loc, toks): # print "symbol", toks c = toks[0] + try: + char = Char(c, self.get_state()) + except ValueError: + raise ParseFatalException("Unknown symbol: %s" % c) + if c in self._spaced_symbols: return [Hlist( [self._make_space(0.2), - Char(c, self.get_state()), + char, self._make_space(0.2)] )] elif c in self._punctuation_symbols: - return [Hlist( [Char(c, self.get_state()), + return [Hlist( [char, self._make_space(0.2)] )] - try: - return [Char(toks[0], self.get_state())] - except ValueError: - raise ParseFatalException("Unknown symbol: %s" % c) + return [char] _accent_map = { r'\hat' : r'\circumflexaccent', @@ -2004,6 +1978,11 @@ elif isinstance(nucleus, Hlist) and hasattr(nucleus, 'function_name'): return nucleus.function_name in self._overunder_functions return False + + def is_dropsub(self, nucleus): + if isinstance(nucleus, Char): + return nucleus.c in self._dropsub_symbols + return False def subsuperscript(self, s, loc, toks): assert(len(toks)==1) @@ -2079,7 +2058,10 @@ return [result] shift_up = nucleus.height - SUBDROP * xHeight - shift_down = SUBDROP * xHeight + if self.is_dropsub(nucleus): + shift_down = nucleus.depth + SUBDROP * xHeight + else: + shift_down = SUBDROP * xHeight if super is None: # @757 sub.shrink() @@ -2091,8 +2073,8 @@ x.shift_amount = shift_down else: super.shrink() - x = Hlist([super]) - x.width += SCRIPT_SPACE * xHeight + x = Hlist([super, Kern(SCRIPT_SPACE * xHeight)]) + # x.width += SCRIPT_SPACE * xHeight clr = SUP1 * xHeight shift_up = max(shift_up, clr) clr = x.depth + (abs(xHeight) / 4.0) @@ -2104,11 +2086,11 @@ y = Hlist([sub]) y.width += SCRIPT_SPACE * xHeight shift_down = max(shift_down, SUB1 * xHeight) - clr = 4.0 * rule_thickness - ((shift_up - x.depth) - (y.height - shift_down)) + clr = 2.0 * rule_thickness - ((shift_up - x.depth) - (y.height - shift_down)) if clr > 0.: shift_up += clr shift_down += clr - x.shift_amount = DELTA * xHeight + x.shift_amount = DELTA * (shift_up + shift_down) x = Vlist([x, Kern((shift_up - x.depth) - (y.height - shift_down)), y]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3653 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3653&view=rev Author: mdboom Date: 2007年08月01日 06:06:07 -0700 (2007年8月01日) Log Message: ----------- Removing test code Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 13:03:00 UTC (rev 3652) +++ trunk/matplotlib/setupext.py 2007年08月01日 13:06:07 UTC (rev 3653) @@ -193,7 +193,6 @@ status, output = commands.getstatusoutput( "%s %s %s" % (pkg_config_exec, flags, packages)) if status == 0: - output += ' -UFOO' for token in output.split(): attr = _flags.get(token[:2], None) if attr is not None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3652 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3652&view=rev Author: mdboom Date: 2007年08月01日 06:03:00 -0700 (2007年8月01日) Log Message: ----------- Fix handling of def/undef macros Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 12:41:17 UTC (rev 3651) +++ trunk/matplotlib/setupext.py 2007年08月01日 13:03:00 UTC (rev 3652) @@ -193,12 +193,19 @@ status, output = commands.getstatusoutput( "%s %s %s" % (pkg_config_exec, flags, packages)) if status == 0: + output += ' -UFOO' for token in output.split(): attr = _flags.get(token[:2], None) if attr is not None: + if token[:2] == '-D': + value = tuple(token[2:].split('=')) + if len(value) == 1: + value = (value[0], None) + else: + value = token[2:] set = getattr(module, attr) - if token[2:] not in set: - set.append(token[2:]) + if value not in set: + set.append(value) else: if token not in module.extra_link_args: module.extra_link_args.append(token) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3651 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3651&view=rev Author: mdboom Date: 2007年08月01日 05:41:17 -0700 (2007年8月01日) Log Message: ----------- Fix wxagg building for earlier versions of wx Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 12:28:24 UTC (rev 3650) +++ trunk/matplotlib/setupext.py 2007年08月01日 12:41:17 UTC (rev 3651) @@ -810,6 +810,7 @@ add_agg_flags(module) add_ft2font_flags(module) + wxconfig = find_wx_config() add_wx_flags(module, wxconfig) ext_modules.append(module) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3650 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3650&view=rev Author: mdboom Date: 2007年08月01日 05:28:24 -0700 (2007年8月01日) Log Message: ----------- Display Python version information in status header Modified Paths: -------------- trunk/matplotlib/setup.py Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007年08月01日 12:26:55 UTC (rev 3649) +++ trunk/matplotlib/setup.py 2007年08月01日 12:28:24 UTC (rev 3650) @@ -116,6 +116,7 @@ print_line() print_raw("BUILDING MATPLOTLIB") print_status('matplotlib', '%s (r%s)' % (__version__, __revision__.split()[-2])) +print_status('python', sys.version) print_status('platform', sys.platform) if sys.platform == 'win32': print_status('Windows version', sys.getwindowsversion()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3649 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3649&view=rev Author: mdboom Date: 2007年08月01日 05:26:55 -0700 (2007年8月01日) Log Message: ----------- Fix wx check and build Modified Paths: -------------- trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007年08月01日 12:19:03 UTC (rev 3648) +++ trunk/matplotlib/setup.py 2007年08月01日 12:26:55 UTC (rev 3649) @@ -238,7 +238,7 @@ if check_for_wx() and BUILD_WXAGG: BUILD_AGG = 1 import wx - if wx.__version__ < (2.8): + if getattr(wx, '__version__', '0.0')[0:3] < '2.8': build_wxagg(ext_modules, packages) wxagg_backend_status = "yes" else: Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 12:19:03 UTC (rev 3648) +++ trunk/matplotlib/setupext.py 2007年08月01日 12:26:55 UTC (rev 3649) @@ -485,14 +485,15 @@ gotit = True if gotit: - module = Extension("test", []) - add_wx_flags(module, wxconfig) - if not find_include_file( - module.include_dirs, - os.path.join("wx", "wxPython", "wxPython.h")): - explanation = ("Could not find wxPython headers in any of %s" % - ", ".join(["'%s'" % x for x in module.include_dirs])) - gotit = False + if getattr(wx, '__version__', '0.0')[0:3] < '2.8': + module = Extension("test", []) + add_wx_flags(module, wxconfig) + if not find_include_file( + module.include_dirs, + os.path.join("wx", "wxPython", "wxPython.h")): + explanation = ("Could not find wxPython headers in any of %s" % + ", ".join(["'%s'" % x for x in module.include_dirs])) + gotit = False if gotit: print_status("wxPython", wx.__version__) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3648 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3648&view=rev Author: mdboom Date: 2007年08月01日 05:19:03 -0700 (2007年8月01日) Log Message: ----------- Earlier versions of pygtk don't have a pygobject version Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年08月01日 12:15:03 UTC (rev 3647) +++ trunk/matplotlib/setupext.py 2007年08月01日 12:19:03 UTC (rev 3648) @@ -409,9 +409,13 @@ if gotit: import gobject + if hasattr(gobject, 'pygobject_version'): + pygobject_version = ver2str(gobject.pygobject_version) + else: + pygobject_version = '[pre-pygobject]' print_status("Gtk+", "gtk+: %s, glib: %s, pygtk: %s, pygobject: %s" % (ver2str(gtk.gtk_version), ver2str(gobject.glib_version), - ver2str(gtk.pygtk_version), ver2str(gobject.pygobject_version))) + ver2str(gtk.pygtk_version), pygobject_version)) else: print_status("Gtk+", "no") print_message(explanation) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3647 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3647&view=rev Author: mdboom Date: 2007年08月01日 05:15:03 -0700 (2007年8月01日) Log Message: ----------- Don't import commands if running on Windows Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年07月31日 18:42:39 UTC (rev 3646) +++ trunk/matplotlib/setupext.py 2007年08月01日 12:15:03 UTC (rev 3647) @@ -60,7 +60,8 @@ } import sys, os, stat -import commands +if sys.platform != 'win32': + import commands from sets import Set from textwrap import fill from distutils.core import Extension This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.