centos 解决转pdf中文乱码(安装中文字体)

本文详细介绍了如何通过yum命令安装fontconfig和相关工具,迁移Windows字体到Linux系统,并配置font目录,以实现中文字体的显示。步骤包括mkfontscale、fc-cache刷新等,确保正确查看中文字符。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装fontconfig来安装字体库

yum install mkfontscale
yum install fontconfig
mkfontscale
mkfontdir

将widows系统中的 字体文件上传至 /usr/shared/fonts/chinese 中

cd  /usr/shared/fonts/chinese
chmod -R 755 /usr/share/fonts/chinese
yum -y install ttmkfdir
vi /etc/fonts/fonts.conf

添加 <dir>/usr/share/fonts/chinese</dir>

<!-- Font directory list -->

    <dir>/usr/share/fonts</dir>
<dir>/usr/share/fonts/chinese</dir> <!--此处添加-->
     <dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir> <dir>/usr/local/share/fonts</dir>
     <dir prefix="xdg">fonts</dir>
     <dir>/usr/share/fonts/chinese<dir>
     <!-- the following element will be removed in the future -->
     <dir>~/.fonts</dir>

fc-cache刷新

fc-cache -f -v
source /etc/profile

此时,使用fc-list:ang=zh即可看到安装的中文字体。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值