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、重啓即可
發佈了30 篇原創文章 · 獲贊 21 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章