Qt Application Fonts Missing or Invisible in Linux (Fixed)

By default Qt does not copy fonts along with your application when you deploy them under Linux. I recently faced this issue and none of the texts or labels on my Qt windows showed anything on them. All labels and text were blank and the forms looked completely empty.

This happened on deploying a statically built application so I realized I needed to deploy my fonts along with my Qt app.

Here is how I fixed this issue:

First create a Qt Resource file and add your font into it.

Let’s assume that our font is Ubuntu’s default “Ubuntu-R.ttf” file, then we need to add the following into our main.cpp


qApp->setFont(QFont(“Ubuntu”, 11, QFont::Normal, false));

Voila! You should have your fonts back.

Leave a Reply

Your email address will not be published. Required fields are marked *