勿知勿畏

centos-7 添加字库

2021-04-14 15:26:43




安装 字体库

yum groupinstall "fonts"

yum -y install fontconfig mkfontscale ttmkfdir



安装 source-code-pro 字体

下载ZIP包:sudo wget https://github.com/downloads/adobe-fonts/source-code-pro/SourceCodePro_FontsOnly-1.013.zip

解压:sudo unzip SourceCodePro_FontsOnly-1.013.zip

创建目录:sudo mkdir ~/.fonts

拷贝字体:sudo cp ./SourceCodePro_FontsOnly-1.013/OTF/* ~/.fonts/

生成新的字体缓存:fc-cache -f -v



添加windows 字库


1、先从你本机 C:\Windows\Fonts 拷贝或者网络上下载你想要安装的字体文件(*.ttf文件)到 /usr/share/fonts/windows


2、修改字体文件的权限,使root用户以外的用户也可以使用


cd /usr/share/fonts/windows

chmod 755 *.ttf


 

搜索目录中所有的字体信息,并汇总生成 fonts.scale 文件

ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir




在 Font directory list 的部分,添加 1 行,内容为 <dir>/usr/share/fonts/windows/</dir>

vim /etc/fonts/fonts.conf

<!-- Font directory list -->

 <dir>/usr/share/fonts</dir>

 <dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir> <dir>/usr/local/share/fonts</dir>

 <dir>/usr/share/fonts/windows/</dir>

 <dir prefix="xdg">fonts</dir>

 <!-- the following element will be removed in the future -->

 <dir>~/.fonts</dir>


3、建立字体缓存


mkfontscale #(如果提示 mkfontscale: command not found,需自行安装 # yum install mkfontscale )

mkfontdir 

fc-cache

fc-cache -fv 


作者:无知勿畏 分类:linux基础 浏览:2271 评论:0
控制面板
您好,欢迎到访网站!
  查看权限
搜索
你好,朋友
真是美好的一天!
«    2025年12月    »
1234567
891011121314
15161718192021
22232425262728
293031
网站分类
站点信息
  • 文章总数:90
  • 页面总数:0
  • 分类总数:9
  • 标签总数:0
  • 评论总数:0
  • 浏览总数:119133