[PyQt] Refreshing QFontDatabase at runtime ?
barry at barrys-emacs.org
Mon Feb 6 16:09:30 GMT 2017
> On 5 Feb 2017, at 04:49, Gottfried Müller <gottfried.mueller at gmx.de> wrote:
> I wanted to add a font file during the runtime of my program in my user font path (Linux: '~/.local/share/fonts'). When I want to use it it is not added in the current QFontDatabase. I have to restart my program. It does not matter installing the font outside or inside of my program. I refreshed also always the font cache with 'fc-cache -f' (inside or outside of the program during the runtime). There is no effect. After the restart of the program the installed font is available.
> I did not find in the Qt documentation any solutions how to refresh the QFontDatabase during the runtime of a program. Is it possible anyway? I know there exists 'addApplicationFont' from a file. But this is not what I want.
I have not looked at the code, but, if Qt uses fontconfig its did not used to be possible refresh fontconfig database. Meaning you have to restart the app.
I hit this problem a couple years ago and did not find a quick fix.
> PyQt mailing list PyQt at riverbankcomputing.com
More information about the PyQt