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、重啓即可