- 论坛徽章:
- 1
|
[教學]中的教學(一) RRDTOOL (像 mrtg 的東西)完全攻略
rrdtool 1.2.8 中文化 Patch , 若不懂 patch 請先研究用法
我只試過 1.2.8 , >;1.2.8 適不適用否我就不知了
Patch 處都做了注解,方便有需要研究的人
新版的 rrd (1.2.x) 調用 FT (freetype2) 做 TTF 輸出
所以程式用 1.0.x 版完全不能適用哦,切記 (僅以此 Patch 加惠有綠人
- diff -u rrdtool-1.2.8/src/rrd_gfx.c rrdtool-1.2.8-big5/src/rrd_gfx.c
- --- rrdtool-1.2.8/src/rrd_gfx.c Fri Jun 10 16:54:58 2005
- +++ rrdtool-1.2.8-big5/src/rrd_gfx.c Fri Jun 10 16:45:42 2005
- @@ -378,6 +378,9 @@
- unsigned int n;
- int error;
- int gottab = 0;
- + // 雙字元處理 multi-bytes 問?#125;
- + wchar_t* w_text;
- +
- ft_pen.x = 0; /* start at (0,0) !! */
- ft_pen.y = 0;
-
- @@ -391,6 +394,11 @@
- 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);
- + // pointer malloc
- + w_text = (wchar_t) calloc (string->;count,sizeof(wchar_t));
- + // 轉換為 wide 型式
- + mbstowcs(w_text,text,string->;count);
- +
-
- use_kerning = FT_HAS_KERNING(face);
- previous = 0;
- @@ -419,8 +427,8 @@
- 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 ) {
- @@ -495,6 +503,8 @@
- } */
- string->;height = string->;bbox.yMax - string->;bbox.yMin;
-
- + free(w_text);
- +
- return string;
- }
-
- diff -u rrdtool-1.2.8/src/rrd_graph.c rrdtool-1.2.8-big5/src/rrd_graph.c
- --- rrdtool-1.2.8/src/rrd_graph.c Fri Jun 10 16:54:58 2005
- +++ rrdtool-1.2.8-big5/src/rrd_graph.c Fri Jun 10 16:36:04 2005
- @@ -2793,7 +2793,9 @@
- tzset();
- #endif
- #ifdef HAVE_SETLOCALE
- - setlocale(LC_TIME,"");
- + //setlocale(LC_TIME,"");
- + // 可以不定 locale , 由系統自動判斷
- + setlocale(LC_ALL,"zh_CN.GB2312");
- #endif
- im->;yorigin=0;
- im->;xorigin=0;
复制代码 |
|