[rrd-users] Text Alignment in Graph Box?

Tobias Oetiker tobi at oetiker.ch
Tue Nov 24 07:46:59 CET 2009


Marc,

Yesterday Marc MERLIN wrote:

> On Tue, Nov 24, 2009 at 06:20:05AM +0100, Tobias Oetiker wrote:
> > Yesterday Marc MERLIN wrote:
> > > On Tue, Nov 24, 2009 at 12:08:34AM +0100, Reinhard Scheck wrote:
> > > > >> My lines are terminated with \n
> > > > >> Can you look at the definition
> > > > >> http://gargamel.merlins.org/cacti/graph.php?action=properties&local_graph_id=14&rra_id=6&view_type=&graph_start=1258976884&graph_end=1258991224
> > > > >> to see if I'm missing something else?
> > > > >
> > > > > \n is not realy a valid choice (it is only accepted for backward
> > > > > bug compatibility) but anyway, since you are NOT using a monospace
> > > > > font you have to use \t for alignment ... which you don't seem to
> > > > > be doing.
> > > >
> > > > As this is a cacti graph, we should mention that at this point cacti does
> > > > "tabular adjustment" based on monospaced fonts only by "tabbing" with blanks.
> > >
> > > I noticed that, but even so I tried 4 monospace fonts and they don't quite
> > > look monospaced as can be seen in the graph above where I end up with a
> > > characters that are half aligned with the characters above and below them.
> >
> > the font in the graph above is NOT monospaced ... try courier.
>
> Thanks Tobias.
>
> This was my problem, all the monospace fonts I tried didn't seem to
> work as intended, even if I saw a different font when I selected them.

the problem is, that since 1.3 rrdtool uses fontconfig ... this
means you can not configure fonts by giving their full path. You
rather have to have them in your fontcache (try fc-list | less).

the lines would have to look like this:

--font 'TITLE:12:Courier New'

cheers
tobi


> http://gargamel.merlins.org/cacti/graph.php?action=properties&local_graph_id=14&rra_id=6&view_type=&graph_start=1258976884&graph_end=1258991224
> now has
> /usr/bin/rrdtool graph - \
> (...)
> --font TITLE:12:/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf \
> --font AXIS:8:/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf \
> --font LEGEND:10:/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf \
> --font UNIT:8:/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf \
> DEF:a="/var/lib/cacti/rra/housetemp_17.rrd":Attic:AVERAGE \
> (...)
> and it still didn't work.
>
> I looks like the problem is with cacti.
> Cacti forces me to give a font path or errors out with "file not found"
> rrdtool seems to want "courier" instead of /usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf
> If I put "courier" and run the rrdtool from the command line as opposed to
> in cacti, then things indeed work.
>
> Reinhard, this seems to be a cacti problem here. Does what I try to do in my
> graph even work for anyone in he latest released cacti?
> Should I just force the font string directly in mysql for now, bypassing the
> web page check?
> Or do you think the alignment code can be changed to just use tabs like it
> seems to be natively supported in new rrdtools now?
>
> Marc
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-users mailing list