QT5在arm板上的汉字显示


1、准备好字库 xx.ttf文件


2、将xx.ttf放到 /usr/share/fonts/ 和 /usr/lib/fonts/ 下   (我自己这块板子需要两个地方都放,可以尝试只放在/usr/share/fonts/下)


3、执行fc-cache -fv 更新缓存


4、执行 fc-list可以参看arm已经支持的字体
root@am57xx-evm:/usr/bin# fc-list
/usr/share/fonts/ttf/LiberationSans-Italic.ttf: Liberation Sans:style=Italic
/usr/share/fonts/ttf/LiberationMono-Regular.ttf: Liberation Mono:style=Regular
/usr/share/fonts/ttf/LiberationSans-Bold.ttf: Liberation Sans:style=Bold
/usr/share/fonts/ttf/LiberationMono-BoldItalic.ttf: Liberation Mono:style=Bold Italic
/usr/share/fonts/ttf/LiberationSans-Regular.ttf: Liberation Sans:style=Regular
/usr/share/fonts/ttf/LiberationSerif-Bold.ttf: Liberation Serif:style=Bold
/usr/share/fonts/ttf/LiberationMono-Italic.ttf: Liberation Mono:style=Italic
/usr/share/fonts/ttf/LiberationSerif-Italic.ttf: Liberation Serif:style=Italic
/usr/share/fonts/ttf/LiberationSans-BoldItalic.ttf: Liberation Sans:style=Bold Italic
/usr/share/fonts/ttf/fzss.ttf: FZFangSong\-Z02S,方正仿宋简体:style=Regular
/usr/share/fonts/ttf/msyh.ttf: Microsoft YaHei,微软雅黑:style=Regular,Normal,oby?ejné,Standard,Κανονικ?,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/ttf/LiberationSerif-BoldItalic.ttf: Liberation Serif:style=Bold Italic
/usr/share/fonts/ttf/LiberationSerif-Regular.ttf: Liberation Serif:style=Regular
/usr/share/fonts/ttf/LiberationMono-Bold.ttf: Liberation Mono:style=Bold
root@am57xx-evm:/usr/bin# 


5、在QT5应用中添加 以微软雅黑为例
   QFont font("Microsoft YaHei");
   a.setFont(font);
   
6、重启即可
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值