prepare for the release of rrdtool-1.2.8
[rrdtool.git] / src / rrd_afm.h
1 /****************************************************************************
2  * RRDtool 1.2.8  Copyright by Tobi Oetiker, 1997-2005
3  ****************************************************************************
4  * rrd_afm.h  Parsing afm tables to find width of strings.
5  ****************************************************************************/
6
7 #ifndef  RRD_AFM_H
8 #define RRD_AFM_H
9
10 /*
11    If the font specified by the name parameter in the routes below
12    is not found
13    (because it is not compiled into rrd_afm_data.c by compile_afm.pl)
14    the font specified by RRD_AFM_DEFAULT_FONT will be used.
15    If it is not installed, it uses the first font compiled
16    into rrd_afm_data.c
17    So they will always use some font.
18 */
19
20 #define RRD_AFM_DEFAULT_FONT "Courier"
21
22 /* measure width of a text string */
23 /* fontname can be full name or postscript name */
24 double afm_get_text_width ( double start, const char* font, double size,
25                             double tabwidth, const char* text);
26
27 double afm_get_ascender(const char* font, double size);
28 double afm_get_descender(const char* font, double size);
29
30 /* get postscript name from fullname or postscript name */
31 const char *afm_get_font_postscript_name ( const char* font);
32 const char *afm_get_font_name(const char* font);
33
34 /* cc -E -dM /dev/null */
35 #ifdef __APPLE__
36 /* need charset conversion from macintosh to unicode. */
37 extern const unsigned char afm_mac2iso[128];
38 #define afm_host2unicode(c) \
39         ( (c) >= 128 ? afm_mac2iso[(c) - 128] : (c))
40 #else
41 /* UNSAFE macro */
42 #define afm_host2unicode(a_unsigned_char) ((unsigned int)(a_unsigned_char))
43 #endif
44
45 #endif