-
Change Request
-
Resolution: Unresolved
-
Trivial
-
None
-
1.9.4 (alpha)
-
None
I suggest a way to automatically change the font based on the user's profile.
Referred to my own idea: http://www.zabbix.com/forum/showthread.php?t=22148&page=2, this approach can automatically change font just by using soft links to the font files and the locale names as the names of the soft links:
First, I added a function setFontnames() into the file include/locales.inc.php as followed.
function setFontnames()
{ global $USER_DETAILS; $ZBX_FONT_NAME = $USER_DETAILS['lang']; $ZBX_GRAPH_FONT_NAME = $USER_DETAILS['lang']; }In the directory fonts, I added some Unicode fonts and added soft links:
i.e.
$ ln -s DejaVuSans.ttf en_GB.ttf
$ ln -s bsmi00lp.ttf zh_CN.ttf
$ ln -s uming.ttc zh_TW.ttf
....
Finally, I called setFontnames() in the file include/graphs.inc.php at the beginning of each of the following functions:
function imageText($image, $fontsize, $angle, $x, $y, $color, $string)
{ setFontnames(); ... }function imageTextSize($fontsize, $angle, $string){ setFontnames(); ... }
Instead of the final step, it would be better to change the font name whenever a user's language has been changed.