X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_gfx.c;h=045892aa2b3c2718f2254f19ff21bb3dd47506b3;hb=ad994d046d175fec8f67cc3b7cddf3cb77d341be;hp=778ba0800d6298d440f905294b14420b99d2afd8;hpb=f9e5bd6a9d41c4607291cbbd88280129184ab325;p=rrdtool.git diff --git a/src/rrd_gfx.c b/src/rrd_gfx.c index 778ba08..045892a 100644 --- a/src/rrd_gfx.c +++ b/src/rrd_gfx.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.2rc6 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2.0 Copyright by Tobi Oetiker, 1997-2005 **************************************************************************** * rrd_gfx.c graphics wrapper for rrdtool **************************************************************************/ @@ -372,6 +372,9 @@ gfx_string gfx_string_create(FT_Face face,const char *text, unsigned int n; int error; int gottab = 0; + #ifdef HAVE_MBSTOWCS + wchar_t* w_text; + #endif ft_pen.x = 0; /* start at (0,0) !! */ ft_pen.y = 0; @@ -387,6 +390,11 @@ gfx_string gfx_string_create(FT_Face face,const char *text, string->transform.yx = (FT_Fixed)( sin(M_PI*(rotation)/180.0)*0x10000); string->transform.yy = (FT_Fixed)( cos(M_PI*(rotation)/180.0)*0x10000); + #ifdef HAVE_MBSTOWCS + w_text = (wchar_t) calloc (string->count,sizeof(wchar_t)); + mbstowcs(w_text,text,string->count); + #endif + use_kerning = FT_HAS_KERNING(face); previous = 0; glyph = string->glyphs; @@ -395,7 +403,7 @@ gfx_string gfx_string_create(FT_Face face,const char *text, /* handle the tabs ... have a witespace glyph inserted, but set its width such that the distance of the new right edge is x times tabwidth from 0,0 where x is an integer. */ - char letter = text[n]; + unsigned char letter = text[n]; gottab = 0; if (letter == '\\' && n+1 < string->count && text[n+1] == 't'){ /* we have a tab here so skip the backslash and @@ -414,7 +422,11 @@ gfx_string gfx_string_create(FT_Face face,const char *text, glyph->pos.y = 0; glyph->image = NULL; +#ifdef HAVE_MBSTOWCS + glyph->index = FT_Get_Char_Index( face, w_text[n] ); +#else glyph->index = FT_Get_Char_Index( face, letter ); +#endif /* compute glyph origin */ if ( use_kerning && previous && glyph->index ) { @@ -480,6 +492,10 @@ gfx_string gfx_string_create(FT_Face face,const char *text, string->width = string->bbox.xMax - string->bbox.xMin; } string->height = string->bbox.yMax - string->bbox.yMin; +#ifdef HAVE_MBSTOWSC + free(w_text); +#endif + return string; } @@ -762,9 +778,9 @@ static int gfx_save_png (art_u8 *buffer, FILE *fp, long width, long height, lon png_set_text (png_ptr, info_ptr, text, 1); /* lets make this fast */ - png_set_filter(png_ptr,0,PNG_FILTER_NONE); + /* png_set_filter(png_ptr,0,PNG_FILTER_NONE); */ png_set_compression_level(png_ptr,1); - png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY); + /* png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY); */ /* png_set_filter(png_ptr,PNG_FILTER_TYPE_BASE,PNG_FILTER_SUB); png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY); @@ -1379,7 +1395,7 @@ static int eps_prologue(eps_state *state) gfx_node_t *node; fputs( "%!PS-Adobe-3.0 EPSF-3.0\n" - "%%Creator: RRDtool 1.2rc6 Tobias Oetiker, http://tobi.oetiker.ch\n" + "%%Creator: RRDtool 1.2.0 Tobias Oetiker, http://tobi.oetiker.ch\n" /* can't like weird chars here */ "%%Title: (RRDtool output)\n" "%%DocumentData: Clean7Bit\n"