Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

<SOLVED> cannot get qpf2 fonts to work with linuxfb platform



  • I am running on an embedded linux device and am trying to experiment with pre-rendered fonts for performance reasons and am running into a roadblock. My app uses three different fonts which are specified via a style string (ie. setStyleSheet). These are:

    • DejaVu Sans 13 px normal
    • DejaVu Sans 15 px normal
    • DejaVu Sans 36 px normal

    I have generated the fonts using makeqpf which generated the following files:

    • dejavu_sans_12_50.qpf2
    • dejavu_sans_15_50.qpf2
    • dejavu_sans_36_50.qpf2

    My font specification in the stylesheet looks something like this:

                        "QWidget {"
                        "     color: #000000;"
                        "     font-family: DejaVu Sans;"
                        "     font-size: 12px;"
                        "     font-weight: normal;"
                        "     font-style: normal;"
                        "     background-color: #ffffff;"
                        "     background-image: none;"
                        "}"
    

    Yet if i remove all of the *.ttf, *.pfa and *.pfb files from my font directory and include only my *.qpf2 fonts, i get black boxes in place of my text. A listing of my fonts directory looks like this:

    -rw-r-----    1 root     root        405944 May  1  2015 dejavu_sans_11_50.qpf2
    -rwxr-xr-x    1 root     root        924116 Jan  1 00:05 dejavu_sans_12_50.qpf2
    -rwxr-xr-x    1 root     root       1204488 Jan  1 00:05 dejavu_sans_15_50.qpf2
    -rwxr-xr-x    1 root     root       6135332 Jan  1 00:05 dejavu_sans_36_50.qpf2
    -rw-r-----    1 root     root          3109 May  1  2015 fixed_120_50.qpf
    -rw-r-----    1 root     root          2567 May  1  2015 fixed_70_50.qpf
    -rw-r-----    1 root     root          3046 May  1  2015 helvetica_100_50.qpf
    -rw-r-----    1 root     root          3052 May  1  2015 helvetica_100_50i.qpf
    -rw-r-----    1 root     root          3040 May  1  2015 helvetica_100_75.qpf
    -rw-r-----    1 root     root          3081 May  1  2015 helvetica_100_75i.qpf
    -rw-r-----    1 root     root          3301 May  1  2015 helvetica_120_50.qpf
    -rw-r-----    1 root     root          3560 May  1  2015 helvetica_120_50i.qpf
    -rw-r-----    1 root     root          3326 May  1  2015 helvetica_120_75.qpf
    -rw-r-----    1 root     root          3759 May  1  2015 helvetica_120_75i.qpf
    -rw-r-----    1 root     root          3860 May  1  2015 helvetica_140_50.qpf
    -rw-r-----    1 root     root          4208 May  1  2015 helvetica_140_50i.qpf
    -rw-r-----    1 root     root          4035 May  1  2015 helvetica_140_75.qpf
    -rw-r-----    1 root     root          4498 May  1  2015 helvetica_140_75i.qpf
    -rw-r-----    1 root     root          5179 May  1  2015 helvetica_180_50.qpf
    -rw-r-----    1 root     root          5778 May  1  2015 helvetica_180_50i.qpf
    -rw-r-----    1 root     root          5712 May  1  2015 helvetica_180_75.qpf
    -rw-r-----    1 root     root          5977 May  1  2015 helvetica_180_75i.qpf
    -rw-r-----    1 root     root          7691 May  1  2015 helvetica_240_50.qpf
    -rw-r-----    1 root     root          8333 May  1  2015 helvetica_240_50i.qpf
    -rw-r-----    1 root     root          7912 May  1  2015 helvetica_240_75.qpf
    -rw-r-----    1 root     root          8588 May  1  2015 helvetica_240_75i.qpf
    -rw-r-----    1 root     root          2735 May  1  2015 helvetica_80_50.qpf
    -rw-r-----    1 root     root          2742 May  1  2015 helvetica_80_50i.qpf
    -rw-r-----    1 root     root          2745 May  1  2015 helvetica_80_75.qpf
    -rw-r-----    1 root     root          2750 May  1  2015 helvetica_80_75i.qpf
    -rw-r-----    1 root     root        263331 May  1  2015 japanese_230_50.qpf
    -rw-r-----    1 root     root          1602 May  1  2015 micro_40_50.qpf
    -rwxr-xr-x    1 root     root         36560 Jan  1 00:05 sans_serif_12_50.qpf2
    -rw-r-----    1 root     root       1215089 May  1  2015 unifont_160_50.qpf
    

    Any idea why Qt doesn't find my qpf2 fonts?



  • I was actually able to get this to work by modifying qtbase/src/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp to create a QPlatformFontDatabase instead of a QGenericUnixFontDatabase for its font database.

    This is not ideal as i would rather not modify the qt source code but I suppose it will work for now.


  • Lifetime Qt Champion

    Hi,

    That might be something worth mentioning on the bug report system


Log in to reply