I have a PostgreSQL database with "UTF-8" encoding which contains data in Russian language. Each table of database loaded in QGIS as a PostGIS layer. I want to show labels of objects on a map.

When I open .qgs file on my machine in QGIS 3.2.2 it works fine. right work

But when I open it via QGIS Server 3.2.2 on dedicated machine I have empty squares instead of text.


Both machines work under Windows 10 (English)

What the problem could be?

Update1: I've also installed QGIS 3.2.3 on my dedicated machine. Russian text also doesn't work there. May this problem be in Apache configuration?

Update2: I've created another win-1251 database. It also doesn't work.

  • Have you found any solution for this problem? I would like to know that too. – Alexey ILchenko Oct 16 '18 at 20:22
  • No, I decided to postpone it for a while. I think I'll return to it next week. I want to debug qgis server source code but it is rather difficult to build because of errors in Python 3.6. So, it's hard to solve it for me. – Alexander Novikov Oct 18 '18 at 8:54
  • I've also created a thread here, but there are no answers too. – Alexander Novikov Oct 18 '18 at 8:56
  • Has there been any resolution to this issue yet? I'm facing the same problem and have until now been unsuccessful in solving it myself. – Edward Ministrator Mar 1 '19 at 8:30

I figured out a solution for this problem which turned out to be kind of a multi-level problem requiring a multi-level solution:

Stage 1: Apparently a QGIS-Server that is running on a Windows OS is not able to resolve the system's font directory in the same way QGIS-Desktop is. Setting QT_QPA_FONTDIR did also not do the trick. As I'm using a QGIS-Server with some modifications anyway and have a working build-system ready to go i made some additions to the server's bootstrapping code, allowing for the specification of a font directory by means of a FCGI variable. The specified directory is then searched for all importable fonts which are added to the server's font database.

Stage 2: After adding the fonts configured in the label settings of my QGIS project to the font directory the missing labels still did not appear at first. The labels in my project are all attribute based and the font selected for rendering them is the common enough Arial. Eventually it turned out that the label attributes contained some special characters which are not present in the Arial character table. In such cases the underlying QT font rendering engine apparently searches through all available fonts, picks the first one supporting the requested character and uses it for rendering the character, while the rest of the label is rendered in Arial. In order to find out which supplemental font is used by QGIS-Desktop i copied a label from the preview box in the layer's property window to MS Word which upon selecting the special character indicates in the font picker tool which font is used. After copying that font to the server's font directory as well - at long last - the server is able to render all labels correctly!

Granted this is not the cleanest solution (being able to use QT_QPA_FONTDIR without any modifications to the server code for example would of course be preferable)... it IS a solution for now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.