使用
patch -p1 -i webalizer-2.01-10.zh_CN_utf8.patch
diff -Nur webalizer-2.01-10/graphs.c webalizer-2.01-10.zh_CN_utf8/graphs.c
--- webalizer-2.01-10/graphs.c 2001-06-15 16:34:24.000000000 +0800
+++ webalizer-2.01-10.zh_CN_utf8/graphs.c 2006-11-22 16:00:31.000000000 +0800
@@ -750,3 +750,14 @@
return;
}
+
+/*
+ * @follow functions is added by redor at Wed Nov 22 14:07:46 CST 2006
+ */
+ void gdImageString(gdImagePtr im, gdFontPtr font, int x, int y, unsigned char *s, int color){
+ gdImageStringFT(im, 0 , color, font_path, 9 , 0.0, x, y+9, s); //font size is 9
+ }
+
+ void gdImageStringUp(gdImagePtr im, gdFontPtr font, int x, int y, unsigned char *s, int color){
+ gdImageStringFT(im, 0 , color, font_path, 9 , -PI/2, x, y-9 , s);
+ }
+
diff -Nur webalizer-2.01-10/sample.conf webalizer-2.01-10.zh_CN_utf8/sample.conf
--- webalizer-2.01-10/sample.conf 2000-09-29 11:51:42.000000000 +0800
+++ webalizer-2.01-10.zh_CN_utf8/sample.conf 2006-11-22 16:00:31.000000000 +0800
@@ -153,6 +153,7 @@
# is 80 characters, so use multiple lines if needed.
#HTMLHead
+HTMLHead
# HTMLBody defined the HTML code to be inserted, starting with the
#tag. If not specified, the default is shown below. If
@@ -569,3 +570,5 @@
#DumpSearchStr no
# End of configuration file... Have a nice day!
+
+FontPath /usr/share/fonts/chinese/TrueType/ukai.ttf
diff -Nur webalizer-2.01-10/webalizer.c webalizer-2.01-10.zh_CN_utf8/webalizer.c
--- webalizer-2.01-10/webalizer.c 2002-04-17 06:11:31.000000000 +0800
+++ webalizer-2.01-10.zh_CN_utf8/webalizer.c 2006-11-22 16:00:31.000000000 +0800
@@ -166,6 +166,8 @@
int dump_search = 0; /* Search strings */
int dump_header = 0; /* Dump header as first rec */
char *dump_path = NULL; /* Path for dump files */
+char *font_path = "/usr/share/fonts/chinese/TrueType/ukai.ttf";
+ /*default font path */
int cur_year=0, cur_month=0, /* year/month/day/hour */
cur_day=0, cur_hour=0, /* tracking variables */
@@ -1449,7 +1451,8 @@
"DNSCache", /* DNS Cache file name 84 */
"DNSChildren", /* DNS Children (0=no DNS) 85 */
"DailyGraph", /* Daily Graph (0=no) 86 */
- "DailyStats" /* Daily Stats (0=no) 87 */
+ "DailyStats", /* Daily Stats (0=no) 87 */
+ "FontPath" /* Font Path 88 */
};
FILE *fp;
@@ -1593,6 +1596,7 @@
#endif /* USE_DNS */
case 86: daily_graph=(value=='n')?0:1; break; /* HourlyGraph */
case 87: daily_stats=(value=='n')?0:1; break; /* HourlyStats */
+ case 88: font_path=save_opt(value); break; /* Font Path */
}
}
fclose(fp);
diff -Nur webalizer-2.01-10/webalizer.h webalizer-2.01-10.zh_CN_utf8/webalizer.h
--- webalizer-2.01-10/webalizer.h 2001-02-10 08:58:18.000000000 +0800
+++ webalizer-2.01-10.zh_CN_utf8/webalizer.h 2006-11-22 16:00:31.000000000 +0800
@@ -219,6 +219,8 @@
extern int dump_header ; /* Dump header as first rec */
extern char *dump_path ; /* Path for dump files */
+extern char *font_path ; /* Chinese font for gragh */
+
extern u_long cur_tstamp; /* Current timestamp */
extern u_long epoch; /* used for timestamp adj. */
extern int check_dup; /* check for dups flag */
我怎麼發現圖形上沒有文字呢,也沒有年份?是我伺服器的問題嗎?大家裝的都正常嗎?另外不知怎麼樣安裝才有「[引用][搜索][代理]」這幾個,我的只有[每日統計] [每小時統計] [進入] [退出] [用戶] [區域] ,應該怎麼樣配置呢?英文版本和UTF8版本的都沒有「[引用][搜索][代理]」。但英文的圖片上什麼都有,看上去挺正常的。中文裝上不能顯示,可能是站點用的是UTF8吧?
我的安裝:
# patch -p1 -i webalizer-2.01-10.zh_CN_utf8.patch
# ./configure --prefix=/usr/local/webalizer --with-gdlib=/usr/local/gd/lib --with-gd=/usr/local/gd/include --with-language=simplified_chinese_utf8 //這裡用simplified_chinese_utf8 還是simplified_chinese呢,一會我再試試用simplified_chinese看看
# make
# make install
[火星人 ] 發布一個webalizer中文UTF-8漢化及圖片修正完全補丁已經有311次圍觀