Wednesday, 12 August 2015

QGIS Server doesn't render any fonts on Ubuntu 16.04


I just updated qgis-server package to latest 3.2.x from Ubuntugis repository (ubuntugis-unstable) and everything works fine - but font rendering. All labels on tiles, legend and print templates show up as squares:


enter image description here



After upgrading I got a lot of this messages in nginx error log:


QFontDatabase: Cannot find font directory /usr/lib/x86_64-linux-gnu/fonts - is Qt installed correctly?

I could fix that by adding a symbolic link from /usr/lib/x86_64-linux-gnu/fonts to /usr/share/fonts and updating font cache with fc-cache -fv. But this brought no changes to visualization of labels.


The QGIS project uses Ubuntu font installed from ttf-ubuntu-font-family package and shows up fine on QGIS Desktop. The font is also listed on the server using fc-list.


There are no error messages related to fonts neither in nginx error log nor in QGIS Server logging. Could be related to Qt so, any hints?



Answer



I put my comment as an answer:


You need to set up the environment variable,export QT_QPA_FONTDIR= for example export QT_QPA_FONTDIR=/usr/share/fonts/open-sans


But when using fastcgi you have to do something like: @geraldo



nginx


fastcgi_param QT_QPA_FONTDIR "/ usr / share / fonts / open-sans"


apache


SetEnv QT_QPA_FONTDIR / usr / share / fonts / open-sans .


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...