- 论坛徽章:
- 0
|
rrdtool 1.2.12版的中文补丁
本补丁参考abel的rrdtool 1.2.8版本制作,已测试,证明可用.
[root@www src]# diff -u rrd_gfx.c.bak rrd_gfx.c
--- rrd_gfx.c.bak 2005-12-19 04:30:45.000000000 +0800
+++ rrd_gfx.c 2006-04-23 11:05:47.000000000 +0800
@@ -384,6 +384,7 @@
int n;
int error;
int gottab = 0;
+ wchar_t* w_text;
#ifdef HAVE_MBSTOWCS
wchar_t *cstr;
@@ -414,6 +415,8 @@
string->transform.xy = (FT_Fixed)(-sin(M_PI*(rotation)/180.0)*0x10000);
string->transform.yx = (FT_Fixed)( sin(M_PI*(rotation)/180.0)*0x10000);
string->transform.yy = (FT_Fixed)( cos(M_PI*(rotation)/180.0)*0x10000);
+ w_text = (wchar_t) calloc (string->count,sizeof(wchar_t));
+ mbstowcs(w_text,text,string->count);
use_kerning = FT_HAS_KERNING(face);
previous = 0;
@@ -443,7 +446,7 @@
glyph->pos.x = 0;
glyph->pos.y = 0;
glyph->image = NULL;
- glyph->index = FT_Get_Char_Index( face, letter );
+ glyph->index = FT_Get_Char_Index( face, w_text[n]);
/* compute glyph origin */
if ( use_kerning && previous && glyph->index ) {
@@ -516,6 +519,7 @@
string->width = string->bbox.xMax - string->bbox.xMin;
} */
string->height = string->bbox.yMax - string->bbox.yMin;
+ free(w_text);
return string;
}
[root@www src]# diff -u rrd_graph.c.bak rrd_graph.c
--- rrd_graph.c.bak 2005-12-19 04:30:45.000000000 +0800
+++ rrd_graph.c 2006-04-23 11:05:53.000000000 +0800
@@ -2871,7 +2871,8 @@
tzset();
#endif
#ifdef HAVE_SETLOCALE
- setlocale(LC_TIME,"");
+ //setlocale(LC_TIME,"");
+ setlocale(LC_ALL,"zh_CN.GB2312");
#endif
im->yorigin=0;
im->xorigin=0;
[ 本帖最后由 zqli 于 2006-4-23 12:12 编辑 ] |
|