added support for getting ascent/descent size info for ps fonts -- Peter Speck
[rrdtool.git] / src / rrd_afm.h
1 /****************************************************************************
2  * RRDtool 1.2.4  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 /* measure width of a text string */
11 /* fontname can be full name or postscript name */
12 double afm_get_text_width ( double start, const char* font, double size,
13                             double tabwidth, const char* text);
14
15 double afm_get_ascender(const char* font, double size);
16 double afm_get_descender(const char* font, double size);
17
18 /* get postscript name from fullname or postscript name */
19 const char *afm_get_font_postscript_name ( const char* font);
20
21 /* cc -E -dM /dev/null */
22 #ifdef __APPLE__
23 /* need charset conversion from macintosh to unicode. */
24 extern const unsigned char afm_mac2iso[128];
25 #define afm_host2unicode(c) \
26         ( (c) >= 128 ? afm_mac2iso[(c) - 128] : (c))
27 #else
28 /* UNSAFE macro */
29 #define afm_host2unicode(a_unsigned_char) ((unsigned int)(a_unsigned_char))
30 #endif
31
32 #endif