[SOLVED] qt font search path



  • I have cross compiled qt for arm and installed it to a local directory /rootfs/qt5.1/ on the host
    to install the result i copy the whole qt5.1 directory to my arm machine at /opt/qt5.1/

    added the /opt/qt5.1/lib to my ldconfig
    and my applications seem to find the libQt5Core.so and libQt5Gui.so but the font seems to fall back to an ugly font type.

    • do i need to set an environment variable to /opt/qt5.1/lib/fonts somewhere so qt can find it ?
    • or do i need to copy this directory to /usr/share/fonts in some manner ?

    i tried
    export QT_QWS_FONTDIR=/opt/qt5.1/lib/fonts/
    but it doesn's work. Arial text still gets rendered to something that looks like "times roman"

    thanks,
    tom



  • hi,

    Are you using tftp debugging?
    Check whether you have the font you used in the target directory?
    It will be somewhere like

    /exports/nfsroot-ccwmx51js/usr/local/QtEmbedded-4.7.1/lib/fonts/

    If its not there then you need to put those fonts in these target directory.



  • hi,

    "may be this link useful for you":http://qt-project.org/forums/viewthread/10102/



  • no, i'm not using tftp debugging.
    i think the QT_QWS_FONTDIR was misleading from my part as i am running on a small arm system but am using xwindows via the xcb platform.

    i did get strace running and i see it opens the right font files

    @strace ./myapp -platform xcb 2>&1 | grep font
    stat64("/opt/qt5.1/lib/fonts", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
    open("/opt/qt5.1/lib/fonts", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 12
    statfs("/opt/qt5.1/lib/fonts/", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=3825781, f_bfree=2905339, f_bavail=2710997, f_files=972944, f_ffree=837568, f_fsid={1863152340, 77042593}, f_namelen=255, f_frsize=4096}) = 0
    open("/opt/qt5.1/lib/fonts/c0419bt_.pfb", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/c0582bt_.pfb", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/c0583bt_.pfb", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/c0611bt_.pfb", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/c0632bt_.pfb", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/c0633bt_.pfb", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/c0648bt_.pfb", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/c0649bt_.pfb", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/cour.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/courb.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/courbi.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/couri.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/cursor.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSans-Bold.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSans-BoldOblique.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSans-Oblique.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSans.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSansMono-Bold.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSansMono-BoldOblique.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSansMono-Oblique.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSansMono.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSerif-Bold.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSerif-BoldOblique.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSerif-Oblique.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/DejaVuSerif.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l047013t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l047016t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l047033t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l047036t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l048013t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l048016t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l048033t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l048036t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l049013t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l049016t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l049033t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/l049036t.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/UTB_____.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/UTBI____.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/UTI_____.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/UTRG____.pfa", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/Vera.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/VeraBd.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/VeraBI.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/VeraIt.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/VeraMoBd.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/VeraMoBI.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/VeraMoIt.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/VeraMono.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/VeraSe.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/VeraSeBd.ttf", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/c0648bt_.pfb", O_RDONLY) = 12
    open("/opt/qt5.1/lib/fonts/cour.pfa", O_RDONLY) = 15@

    the funny thing is that i set the font to be Arial, 14 in my dialog, yet i do not see it even try to open an arial font. Also it looks like Arial isn't even in the
    /opt/qt5.1/lib/fonts/ directory..

    i guess it could be a cross-compile problem, where a particular font is available on Ubuntu 64 desktop, but not in the default font directory supplied by the qt-everywhere-src release ?

    ps: both tftp debugging and makeqpf look interesting, but i'm not sure if it applies to non-embedded versions of qt ?



  • ah found it !
    the arial fonts aren't in the qt package

    • i added

    bq. arialbd.ttf
    arialbi.ttf
    Arial_Black.ttf
    Arial_Bold_Italic.ttf
    Arial_Bold.ttf
    Arial_Italic.ttf
    ariali.ttf
    arial.ttf
    Arial.ttf

    to the qt/lib/fonts directory for my cross compile

    • recompiled
    • copied the font files to my device at /opt/qt5.1/lib/fonts/
    • started the application and it now picks up the Arial fonts

    thanks @dreamerindia for the debug suggestion, it made me think about strace



  • Are you legally permitted to distribute those fonts? If you are not (typically the case) then you should use a free equivalent,



  • Hi,
    nice you solved it.Edit this forum title and add [Solved]. :-)



  • will do. thanks ! i was looking for a button to mark the item as solved..


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.