phpipam icon indicating copy to clipboard operation
phpipam copied to clipboard

Device name in the Rack,displayed "□□□“

Open desboy opened this issue 2 years ago • 7 comments

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:

  1. Go to 'RACK details RACK details 2.see the devics (contains Chinese name) on the right in the Rack,displayed "□□□“,

desboy avatar Nov 11 '24 13:11 desboy

This problem is a font problem. The font they use, MesloLGS-Regular.ttf, does not support Chinese. @desboy @GaryAllan

wxtewx avatar Dec 03 '24 09:12 wxtewx

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

GaryAllan avatar Dec 03 '24 21:12 GaryAllan

Added support for Chinese, Japanese, Korean, Arabic, Hindi in MesloLGS-Regular.ttf image MesloLGS-Regular-mu.zip The font size is recommended to be changed from 8 to 10 @GaryAllan

wxtewx avatar Dec 04 '24 09:12 wxtewx

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....

GaryAllan avatar Dec 04 '24 13:12 GaryAllan

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

wxtewx avatar Dec 04 '24 14:12 wxtewx

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

wxtewx avatar Dec 18 '24 15:12 wxtewx

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 );

inetsurfer avatar Dec 26 '25 02:12 inetsurfer