Qt Use Multiple Fonts at the Same Time

陌路散爱 提交于 2019-12-05 01:17:16

Like others said – if your QT version uses fontconfig do it through fontconfig, its sole function is to manage smart font substitions. And if your version does not use fontconfig you're out of luck since I doubt anyone invested much time in getting it to work now that fontconfig is widely available.

qehgt

Try to use this approach: How to (properly) output multilingual text in Qt-Embedded?

It works with lots of languages simultaneously (Cyrillic, European, Thai, Japanese, etc).

  • Put Droid Fonts (not necessary, it should work with other fonts too) into a directory where Qt can find it,
  • Export special environment variable: export QWS_NO_SHARE_FONTS=1
  • Run your application with -fn "Droid Sans" parameter

Qt has a fallback machinsim for such situations. In Qt4 documentation I've found you can customize this fallback mechanism. Looks very promising and should solve your problem.

In Qt5 I don't see direct link to QPlatformFontDatabase class. Only this. It looks like you should write some plugin. Also this page suggest that QPlatformFontDatabase apeared in Qt 5.2 so it should work in Qt5. For some reason there is no documentation about it for Qt5.

You should try it and see or at least take a pick in sources.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!