Device name in the Rack,displayed "□□□“
Describe the bug No matter what language you were set,when the device name contain Chinese,in the Rack details page,device name in the Rack,displayed "□□□“,
- phpIPAM 1.7
- OS [CentOS 8.4 64bit]
- PHP version [8.3]
- Webserver [Apache 2.4.62]
- Database [MySQL 8.0.24]
Steps To Reproduce Please include steps to reproduce the issue:
- Go to 'RACK details
2.see the devics (contains Chinese name) on the right in the Rack,displayed "□□□“,
This problem is a font problem. The font they use, MesloLGS-Regular.ttf, does not support Chinese. @desboy @GaryAllan
imagefttext() takes a path to a single font, not a font family.
If you know of a free .TTF font with all the Glyphs for all languages post a link and I'll switch to it.
Using HTML canvas may be a better approach.....PRs welcome
Added support for Chinese, Japanese, Korean, Arabic, Hindi in MesloLGS-Regular.ttf
MesloLGS-Regular-mu.zip
The font size is recommended to be changed from 8 to 10
@GaryAllan
Thanks, looks promising. Can you point me at the source where I can download these fonts?
I'm a bit paranoid accepting binary .zip and binary font files from strangers. (No offence intended)....avoid libxz backdoor type issues, confirm font licencing terms etc....
Sorry, there is no place to download it. This is the font file I added and merged. The software for extracting and merging fonts is: FontForge. This software is open source and can be found on Github. The original merged font is MesloLGS-Regular.ttf in phpipam. Other supported fonts are font files in the font library that comes with the Windows system. @GaryAllan
Hello, I am happy to tell you that I have found a font that can support most languages. I have tested more than 20 languages and they can all be displayed normally. The download address is: https://unifoundry.com/pub/unifont/unifont-16.0.02/font-builds/unifont-16.0.02.otf. You can go to the official website for more detailed introduction. The official website address is: https://unifoundry.com/ @GaryAllan
OK,I see, Edit phpipam/functions/classes/class.Rackspace.php,and search
imagettftext($img, 8, 0, (int) $x/2, (int) $y/2, $color, dirname(__FILE__)."/../../css/fonts/MesloLGS-Regular.ttf", $text );
change to
imagettftext($img, 11, 0, (int) $x/2, (int) $y/2, $color, dirname(__FILE__)."/../../css/fonts/unifont-16.0.02.otf", $text );