[rrd-users] problem with changing the font

Dmitry B. Bigunayk icestar at inbox.ru
Fri Jun 6 10:53:59 CEST 2008


Hello!

I've developed the simplest example to illustrate the problem with
changing the font.

#####################################
#!/bin/bash

ENC=POSIX
FONT=/usr/share/fonts/corefonts/times.ttf

LANG=$ENC rrdtool graph /tmp/out.png \
--title=Title  \
--vertical-label=%  \
--width=919 \
--height=230 \
--imgformat=PNG \
--font=DEFAULT:18:$FONT \
DEF:d0=/common/Base855Dev42.rrd:DS859Dev:AVERAGE \
VDEF:d0max=d0,MAXIMUM \
VDEF:d0avg=d0,AVERAGE \
VDEF:d0min=d0,MINIMUM AREA:d0\#FF0000:"CPU"\n
#####################################

It seems to me that --font option doesn't affect the behavior of
rrdtool.
I traced the script using strace utility and found that
/usr/share/fonts/corefonts/times.ttf is even not opened by rrdtool.

server ~ # strace -fFv -s 1000 ./rrd_example.sh 2>&1 | grep -i ttf  |
grep open
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 3
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 3
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 3
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 3
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 3
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 3
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
[pid 14838] open("/usr/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf",
O_RDONLY) = 4
server ~ #

Setting RRD_DEFAULT_FONT variable fixes the problem:

server ~ # strace -fFv -s 1000 ./rrd_example.sh 2>&1 | grep -i ttf  |
grep open
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 3
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 3
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 3
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 3
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 3
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 3
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
[pid 16606] open("/usr/share/fonts/corefonts/times.ttf", O_RDONLY) = 4
server ~ #

However, I want to change the font using command line option.
What's wrong with "--font"?

RRDtool version is 1.2.27

Thank you beforehand!

-- 
Dima: Nosce te ipsum
e-mail: icestar at inbox.ru



More information about the rrd-users mailing list