Skip to content

Commit 8b48580

Browse files
committed
rewrote ft2font using cxx
svn path=/trunk/matplotlib/; revision=334
1 parent 179ca0c commit 8b48580

File tree

6 files changed

+297
-77
lines changed

6 files changed

+297
-77
lines changed

CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
New entries should be added at the top
22

3+
2004-06-08 Rewrote ft2font using CXX as part of general memory leak
4+
fixes - JDH
5+
36
2004-06-07 Fixed several problems with log ticks and scaling - JDH
47

58
2004-06-07 Fixed width/height issues for images - JDH
@@ -16,7 +19,6 @@ New entries should be added at the top
1619

1720
2004-05-31 Added renderer markeredgewidth attribute of Line2D. - ADS
1821

19-
2022
2004-05-29 Fixed tick label clipping to work with navigation.
2123

2224
2004-05-28 Added renderer grouping commands to support groups in

setupext.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def add_gd_flags(module):
9494

9595
def add_ft2font_flags(module):
9696
'Add the module flags to build extensions which use gd'
97-
module.libraries.extend(['freetype', 'z'])
97+
module.libraries.extend(['freetype', 'z' ])
9898
add_base_flags(module)
9999

100100
basedirs = module.include_dirs[:] # copy the list to avoid inf loop!
@@ -114,7 +114,7 @@ def add_ft2font_flags(module):
114114
module.libraries.append('gw32c')
115115

116116
# put this last for library link order
117-
module.libraries.append('m')
117+
module.libraries.extend(['stdc++', 'm'])
118118

119119

120120

@@ -245,10 +245,11 @@ def build_windowing(ext_modules, packages):
245245
def build_ft2font(ext_modules, packages):
246246
global BUILT_FT2FONT
247247
if BUILT_FT2FONT: return # only build it if you you haven't already
248-
module = Extension('matplotlib.ft2font',
249-
['src/ft2font.c',
250-
],
251-
)
248+
deps = ['src/ft2font.cpp']
249+
deps.extend(glob.glob('CXX/*.cxx'))
250+
deps.extend(glob.glob('CXX/*.c'))
251+
252+
module = Extension('matplotlib.ft2font', deps)
252253
add_ft2font_flags(module)
253254
ext_modules.append(module)
254255
BUILT_FT2FONT = True
@@ -301,7 +302,7 @@ def build_agg(ext_modules, packages):
301302
global BUILT_AGG
302303
if BUILT_AGG: return # only build it if you you haven't already
303304

304-
deps = ['src/_backend_agg.cpp', 'src/ft2font.c']
305+
deps = ['src/_backend_agg.cpp', 'src/ft2font.cpp']
305306
deps.extend(glob.glob('agg2/src/*.cpp'))
306307
deps.extend(glob.glob('CXX/*.cxx'))
307308
deps.extend(glob.glob('CXX/*.c'))

src/_backend_agg.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ RendererAgg::draw_text(const Py::Tuple& args) {
804804
args.verify_length(4);
805805

806806

807-
FT2FontObject *font = (FT2FontObject *)args[0].ptr();
807+
FT2Font *font = static_cast<FT2Font*>(args[0].ptr());
808808

809809
int x = Py::Int( args[1] );
810810
int y = Py::Int( args[2] );
@@ -918,6 +918,7 @@ RendererAgg::write_rgba(const Py::Tuple& args) {
918918
Py::Object
919919
RendererAgg::write_png(const Py::Tuple& args)
920920
{
921+
//small memory leak in this function - JDH 2004-06-08
921922
if (debug)
922923
std::cout << "RendererAgg::write_png" << std::endl;
923924

0 commit comments

Comments
 (0)