CentOS install Chinese Fonts



When we encounter some Chinese display garbled problems, it may be because the server does not install Chinese fonts


1. View system fonts
Before starting the installation, we first check the installed fonts in the system. To view the installed fonts in the system, we can use thefc-listIf there is no command in the system, we need to install the relevant software package first.
On CentOS, use the following command to install:

yum install -y fontconfig mkfontscale

2. After installation, we can check the fonts installed in the system

[[email protected] php]# fc-list
/usr/share/fonts/urw-base35/NimbusMonoPS-Italic.otf: Nimbus Mono PS:style=Italic
/usr/share/fonts/urw-base35/D050000L.t1: D050000L:style=Regular

3. To view the Chinese fonts installed in the system, we can use the following command

[[email protected] php]# fc-list :lang=zh

From the above figure, we can see that there is no Chinese font in the system

4. We go to the Windows font directory


5. Will simfang.ttf Copy fonts remotely or put them into the server’s font directory in other ways

//Remote replication
scp simfang.ttf [email protected]:/usr/share/fonts

6. Then the font index information is established and the font cache is updated

cd /usr/share/fonts/

7. At this point, the font has been installed. Now let’s check whether the Chinese font is installed successfully

[[email protected] php]# fc-list :lang=zh
/usr/share/fonts/ simfang.ttf : Fangsong, Fangsong: style = regular, normal, oby TCH ejn é, standard, Γ νιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιι

From the above figure, we can clearly see that the Chinese font has been successfully installed.

This work adoptsCC agreementThe author and the link to this article must be indicated in the reprint

Recommended Today

PHP 12th week function learning record

sha1() effect sha1()Function to evaluate the value of a stringSHA-1Hash. usage sha1(string,raw) case <?php $str = “Hello”; echo sha1($str); ?> result f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0 sha1_file() effect sha1_file()Function calculation fileSHA-1Hash. usage sha1_file(file,raw) case <?php $filename = “test.txt”; $sha1file = sha1_file($filename); echo $sha1file; ?> result aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d similar_text() effect similar_text()Function to calculate the similarity between two strings. usage similar_text(string1,string2,percent) case […]