X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_afm.h;fp=src%2Frrd_afm.h;h=9d12e494cf49187314278f9a8532d86a825ac09f;hb=7006a00dd484cfe2cfe7b58eb5e4391fdb1fd1d4;hp=cedc9949d30a42ae76e54aafee405e1c87651f1b;hpb=4833ff562f0b629f204e79c20a253b3005611991;p=rrdtool.git diff --git a/src/rrd_afm.h b/src/rrd_afm.h index cedc994..9d12e49 100644 --- a/src/rrd_afm.h +++ b/src/rrd_afm.h @@ -7,6 +7,13 @@ #ifndef RRD_AFM_H #define RRD_AFM_H +#include + +#ifdef HAVE_MBSTOWCS +#define afm_char wchar_t +#else +#define afm_char unsigned char +#endif /* If the font specified by the name parameter in the routes below is not found @@ -21,8 +28,10 @@ /* measure width of a text string */ /* fontname can be full name or postscript name */ -double afm_get_text_width ( double start, const char* font, double size, +double afm_get_text_width( double start, const char* font, double size, double tabwidth, const char* text); +double afm_get_text_width_wide( double start, const char* font, double size, + double tabwidth, const afm_char* text); double afm_get_ascender(const char* font, double size); double afm_get_descender(const char* font, double size); @@ -35,11 +44,11 @@ const char *afm_get_font_name(const char* font); #ifdef __APPLE__ /* need charset conversion from macintosh to unicode. */ extern const unsigned char afm_mac2iso[128]; -#define afm_host2unicode(c) \ - ( (c) >= 128 ? afm_mac2iso[(c) - 128] : (c)) +#define afm_fix_osx_charset(c) \ + ( (c) >= 128 && (c) <= 255 ? afm_mac2iso[(c) - 128] : (c)) #else /* UNSAFE macro */ -#define afm_host2unicode(a_unsigned_char) ((unsigned int)(a_unsigned_char)) +#define afm_fix_osx_charset(x) (x) #endif #endif