您的位置:首页 > 编程语言 > Qt开发

QT5在arm板上的汉字显示

2017-01-16 11:53 190 查看
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、重启即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  arm qt5 汉字显示