[rrd-developers] [patch] stringwidth patch for SVG etc.
speck at ruc.dk
Sat Mar 30 04:47:17 MET 2002
Patches for the stringwidth part of SVG implementation. The patch is for
To reduce runtime overhead for using AFM files I have chosen to encode
them as constant C globals instead of parsing the files at runtime. This
is done by the perl script compile_afm.pl which parses the afm files and
generates src/rrd_afm_data.c The format is documented in rrd_afm_data.h
All the font data and the perl script are stored in a new directory:
libraries/afm. Adobe allows distribution and modification of the *.afm
files as long as the copyright message is not changed.
The files have the generic afm names: rrd_afm.h/c and rrd_afm_data.h/c
as the afm font info will be useful for implementing EPS/PDF formats as
they use the same font metrics. I'll implement the EPS format in a few
Users can add their own fonts, run the perl script and recompile
rrdtool. The included set of fonts are required by all postscript (like)
devices so users can count on having them in their printer/viewer. I use
"Helvetica" as default, so that one should stay, all others can be
removed to save space. The perl script uses all the .afm files in the
As gfx_get_text_width() doesn't have gfx_canvas_t as param, I needed to
hack a parameter for knowing if it should use FreeType or AFM.
Some of the functions that call gfx_get_text_width() doesn't have
gfx_canvas_t as param either, so I've made a quick hack that I think
should be rethought:
I have added an enum "fl_en fontlib" as first parameter to
gfx_get_text_width() and to image_desc_t because image_desc_t was passed
all the way around.
The afm code knows the macintosh charset so it works correctly on that
platform. If Windows needs conversion, I'll add that, just give me a
pointer to a charset table.
I have seperated the patch into 3 parts to make it easier to apply:
contains the library/afm directory.
contains the src/rrd_afm.[hc] and src/rrd_afm_data.[hc] files.
contains patches to src/rrd_gfx.[hc] and src/rrd_graph.c and
You can too get all of it in one huge patch:
I have updated the samples:
http://vitality.dk/rrdtool/samle.html (44Kb, for viewing the source)
http://vitality.dk/rrdtool/samle.svg (37Kb, for SVG viewer)
http://vitality.dk/rrdtool/samle.svgz (11Kb, ditto, compressed)
http://vitality.dk/rrdtool/samle.png (46Kb, screendump)
My web provider hasn't added svg/svgz yet to the list of mime types, so
you might have best luck by downloading the .svg file before viewing it.
- Peter Speck
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
More information about the rrd-developers