Centos7.X上安装英文字体及相关配置

文章目录

序言

Linux字体文件置于/usr/share/font/,只要将字体文件拷贝到这儿就可以了。

这儿示例安装Windows的所有字体。

1,新建路径储存字体库:/usr/share/fonts/

2,步入Windows下>的字体库目录c:windowsFonts。复制字体库到创建好的字体库目录/usr/share/fonts/。

3linux入门,步入字体库目录,刷新系统即刻生效linux操作系统安装仿宋字体,输入:mkfontscale;mkfontdir;fc-cache。

一、查看系统字体

在开始安装之前,我们先查看系统中早已安装的字体。

要查看系统中早已安装的字体,我们可以使用fc-list进行查看。若果系统中没有该的话,我们须要先安装相关的软件包。

查看系统类型:cat/etc/issue

在centos上,使用如下命令进行安装:

yuminstall-yfontconfigmkfontscale

在ubuntu上linux操作系统安装仿宋字体,使用如下命令进行安装:

sudoapt-get-yinstallfontconfigxfonts-utils

查看系统默认字体:fc-list

假如要查看系统中早已安装的英文字体,我们可以使用如下命令:fc-list:lang=zh

按照提示安装相关的依赖包

yum install -y libX11 libXext libXrender libjpeg xorg-x11-fonts-75dpi xorg-x11-fonts-Type1

二、安装字体

上传字体文件到/usr/share/fonts/chinese

之后执行字体缓存更新

在这里插入图片描述

[root@shigj fonts]# cd /usr/share/fonts/chinese
[root@shigj fonts]# mkfontscale
[root@shigj fonts]# mkfontdir
[root@shigj fonts]# fc-cache -fv 
/usr/share/fonts: caching, new cache contents: 2 fonts, 0 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/var/cache/fontconfig: cleaning cache directory
/root/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded
fc-cache -fv

三、检测linux上安装的英文字体

[root@webadmin01 chinese]# fc-list :lang=zh-cn
/usr/share/fonts/chinese/youyuan.TTF: YouYuan:style=Regular
/usr/share/fonts/chinese/Songti.ttc: STSong:style=Regular,Normaali
/usr/share/fonts/chinese/Songti.ttc: Songti TC,宋体-,宋體-繁:style=Regular,常规体,標準體
/usr/share/fonts/chinese/Songti.ttc: Songti SC,宋体-,宋體-簡:style=Regular,常规体,標準體
/usr/share/fonts/chinese/MSYH.TTC: Microsoft YaHei:style=Normal
/usr/share/fonts/chinese/SIMSUN.TTC: SimSun,宋体:style=Regular,常规
/usr/share/fonts/chinese/Songti.ttc: Songti SC,宋体-,宋體-簡:style=Light,细体,細體
/usr/share/fonts/chinese/MSYHBD.TTC: Microsoft YaHei:style=Έντονα
/usr/share/fonts/chinese/STKAITI.TTF: STKaiti:style=Regular
/usr/share/fonts/chinese/Songti.ttc: Songti TC,宋体-,宋體-繁:style=Light,细体,細體

操作系统中字体的安装_linux操作系统安装仿宋字体_linux安装宋体

/usr/share/fonts/chinese/MSYH.TTC: Microsoft YaHei UI:style=Normal /usr/share/fonts/chinese/隶书.ttf: LiSu:style=Regular /usr/share/fonts/chinese/MSYHBD.TTC: Microsoft YaHei UI:style=Έντονα /usr/share/fonts/chinese/STFANGSO.TTF: STFangsong:style=Regular /usr/share/fonts/chinese/SIMSUN.TTC: NSimSun,新宋体:style=Regular,常规 /usr/share/fonts/chinese/MSYHL.TTC: Microsoft YaHei UI,Microsoft YaHei UI Light:style=Light,Regular /usr/share/fonts/chinese/Songti.ttc: Songti SC:style=Black /usr/share/fonts/chinese/SIMKAI.TTF: KaiTi:style=Regular,Normaali /usr/share/fonts/chinese/Songti.ttc: Songti SC,宋体-,宋體-簡:style=Bold,粗体,粗體 /usr/share/fonts/chinese/Songti.ttc: Songti TC,宋体-,宋體-繁:style=Bold,粗体,粗體 /usr/share/fonts/chinese/STSONG.TTF: STSong:style=Regular /usr/share/fonts/chinese/仿宋_GB2312.ttf: FangSong_GB2312:style=Regular /usr/share/fonts/chinese/SIMHEI.TTF: SimHei:style=Normal /usr/share/fonts/chinese/楷体_GB2312.ttf: KaiTi_GB2312:style=Regular /usr/share/fonts/chinese/SIMFANG.TTF: FangSong:style=Regular,Normaali /usr/share/fonts/chinese/MSYHL.TTC: Microsoft YaHei,Microsoft YaHei Light:style=Light,Regular

检测能够解析英文字体名

for family in 微软雅黑 宋体 黑体 仿宋 仿宋_GB2312 楷体 楷体_GB2312 隶书 幼圆; do   echo -n "$family: ";   fc-match "$family"; done

发觉不能正常解析

[root@webadmin01 chinese]# for family in 微软雅黑 宋体 黑体 仿宋 仿宋_GB2312 楷体 楷体_GB2312 隶书 幼圆; do   echo -n "$family: ";   fc-match "$family"; done
微软雅黑: DejaVuSans.ttf: "DejaVu Sans" "Book"
宋体: SIMSUN.TTC: "SimSun" "Regular"
黑体: DejaVuSans.ttf: "DejaVu Sans" "Book"
仿宋: DejaVuSans.ttf: "DejaVu Sans" "Book"
仿宋_GB2312: DejaVuSans.ttf: "DejaVu Sans" "Book"
楷体: DejaVuSans.ttf: "DejaVu Sans" "Book"
楷体_GB2312: DejaVuSans.ttf: "DejaVu Sans" "Book"
隶书: DejaVuSans.ttf: "DejaVu Sans" "Book"
幼圆: DejaVuSans.ttf: "DejaVu Sans" "Book"

四、配置别称

vim/etc/fonts/fonts.conf

在配置节之间降低以下match标签linux操作系统论文,降低英文字体解析规则。

  <!-- 为微软雅黑 宋体 黑体 仿宋 仿宋_GB2312 楷体 楷体_GB2312 隶书 幼圆;配置别名 -->
  
    <test name="family">微软雅黑</string></test>
    <edit name="family" mode="assign" binding="strong">
      Microsoft YaHei</string>
    </edit>
  </match>
  
    <test name="family">宋体</string></test>
    <edit name="family" mode="assign" binding="strong">
      SimSun</string>
    </edit>
  </match>
  
    <test name="family">黑体</string></test>
    <edit name="family" mode="assign" binding="strong">
      SimHei</string>
    </edit>
  </match>
  
    <test name="family">仿宋</string></test>
    <edit name="family" mode="assign" binding="strong">
      FangSong</string>
    </edit>
  </match>
   
    <test name="family">仿宋_GB2312</string></test>
    <edit name="family" mode="assign" binding="strong">
      FangSong_GB2312</string>
    </edit>
  </match>
   
    <test name="family">楷体</string></test>
    <edit name="family" mode="assign" binding="strong">
      KaiTi</string>
    </edit>
  </match>
  
    <test name="family">楷体_GB2312</string></test>
    <edit name="family" mode="assign" binding="strong">
      KaiTi_GB2312</string>
    </edit>
  </match>
  
    <test name="family">隶书</string></test>
    <edit name="family" mode="assign" binding="strong">
      LiSu</string>
    </edit>
  </match>
  
    <test name="family">幼圆</string></test>
    <edit name="family" mode="assign" binding="strong">
      YouYuan</string>
    </edit>
  </match>

linux操作系统安装仿宋字体_操作系统中字体的安装_linux安装宋体

配置后,再度检测解析情况

[root@webadmin01 chinese]# for family in 微软雅黑 宋体 黑体 仿宋 仿宋_GB2312 楷体 楷体_GB2312 隶书 幼圆; do   echo -n "$family: ";   fc-match "$family"; done
微软雅黑: MSYH.TTC: "Microsoft YaHei" "Normal"
宋体: SIMSUN.TTC: "SimSun" "Regular"
黑体: SIMHEI.TTF: "SimHei" "Normal"
仿宋: SIMFANG.TTF: "FangSong" "Regular"
仿宋_GB2312: 仿宋_GB2312.ttf: "FangSong_GB2312" "Regular"
楷体: SIMKAI.TTF: "KaiTi" "Regular"
楷体_GB2312: 楷体_GB2312.ttf: "KaiTi_GB2312" "Regular"
隶书: 隶书.ttf: "LiSu" "Regular"
幼圆: youyuan.TTF: "YouYuan" "Regular"

本文原创地址://lrxjmw.cn/rhzlxtzazwzt.html编辑:刘遄,审核员:暂无