[rrd-developers] [patch] stringwidth patch for SVG etc.
Peter Speck
speck at ruc.dk
Sat Mar 30 04:47:17 MET 2002
Hi,
Patches for the stringwidth part of SVG implementation. The patch is for
current CVS.
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
days.
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
directory.
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:
1) http://www.vitality.dk/rrdtool/patches/2002-03-30-libafm.diff
contains the library/afm directory.
2) http://www.vitality.dk/rrdtool/patches/2002-03-30-rrd_afm.diff
contains the src/rrd_afm.[hc] and src/rrd_afm_data.[hc] files.
3) http://www.vitality.dk/rrdtool/patches/2002-03-30-misc.diff
contains patches to src/rrd_gfx.[hc] and src/rrd_graph.c and
Makefile.am
You can too get all of it in one huge patch:
http://www.vitality.dk/rrdtool/patches/2002-03-30-full.diff
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
Archive http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-developers
mailing list