Qt5 Font arm linux


1. ubuntu 下查看当前字体库命令: fc-list

/usr/share/fonts/chinese/msyhbd.ttf: Microsoft YaHei UI:style=Bold,Negreta,tu?né,fed,Fett,?ντονα,Negrita,Lihavoitu,Gras,Félk?vér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kal?n,Krepko,Lodia
/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/chinese/simsun.ttf: SimSun,宋体:style=Regular,常规
/usr/share/fonts/ttf/LiberationSans-Bold.ttf: Liberation Sans:style=Bold
/usr/share/fonts/chinese/msyh.ttf: Microsoft YaHei,微软雅黑:style=Regular,Normal,oby?ejné,Standard,Κανονικ?,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/ttf/LiberationMono-BoldItalic.ttf: Liberation Mono:style=Bold Italic

或只查看中文字库: fc-list :lang=zh

/usr/share/fonts/chinese/msyhbd.ttf: Microsoft YaHei UI:style=Bold,Negreta,tu?né,fed,Fett,?ντονα,Negrita,Lihavoitu,Gras,Félk?vér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kal?n,Krepko,Lodia
/usr/share/fonts/chinese/simsun.ttf: SimSun,宋体:style=Regular,常规
/usr/share/fonts/chinese/msyh.ttf: Microsoft YaHei,微软雅黑:style=Regular,Normal,oby?ejné,Standard,Κανονικ?,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/chinese/msyh.ttf: Microsoft YaHei UI:style=Regular,Normal,oby?ejné,Standard,Κανονικ?,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/chinese/msyhl.ttf: Microsoft YaHei,微软雅黑,Microsoft YaHei Light,微软雅黑 Light:style=Light,Regular
/usr/share/fonts/chinese/msyhbd.ttf: Microsoft YaHei,微软雅黑:style=Bold,Negreta,tu?né,fed,Fett,?ντονα,Negrita,Lihavoitu,Gras,Félk?vér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kal?n,Krepko,Lodia
/usr/share/fonts/chinese/simsun.ttf: NSimSun,新宋体:style=Regular,常规

系统中添加字库,以中文为例:

a. 在/usr/share/fonts/下新建fold, 比如chinese

b. 将Windows下 c:\Windows\Fonts中文字体拷贝到上述文件夹, 如simsumb.ttf, simsum.ttf, msyh.ttf, msyhbd.ttf

  如果是ttc为后缀的,改成.ttf

c. cd /usr/share/fonts/chinese

d. 执行以下2条命令

  mkfontscale

  mkfontdir

3. 再次查看字体文件

  fc-list :lang=zh

  就会看到刚刚看到的字体

Qt5 linux arm FONTS:

1. 关键点是QT_QPA_FONTDIR

  确认QT安装路径,如/opt/Qt-arm-5.9.7, 则字体文件路径为/opt/Qt-arm-5.9.7/lib/fonts

  也可以通过宏设置:

  export QTDIR=/opt/Qt-arm-5.6.3

  export QTEDIR=$QTDIR

  export QT_QPA_FONTDIR=$QTDIR/lib/fonts

2. 把字体文件拷贝到Qt字体路径下就OK了