2

I created a QGIS project on Linux. The project has a label for some features and the font is set to the default selection which is "Liberation Sans".

When I open this file on QGIS in Windows, I get the following error/warning:

Font "liberation sans" not available on system

Liberation Sans is almost exactly the same thing as Arial. It looks exactly the same. But due to licensing issues the font was redefined/reinvented or maybe just renamed on Unix Systems. At least that is how I understand it.

What are the options for making a QGIS project portable from Unix to Windows and vice versa? Obviously I can distribute the font together with the project, but there must be a better way.

  • Linux: 3.26.1-Buenos Aires
  • Windows: 3.20.0-Odense
2
  • The easiest way would be to install Arial on Linux, and you it in QGIS. So that you’ll be sure that when it is open on Windows, it won’t prompt an error!
    – katagena
    Oct 24, 2022 at 7:17
  • I find that many Linux systems are set up to automatically map Arial to Liberation Sans if the former is not installed. The Liberation fonts are (as you surmise) designed to be fallback fonts, after all.
    – trlkly
    Oct 24, 2022 at 20:37

2 Answers 2

4

If you cant or dont want to install new font on either operating system you may use an expression to set the font depending on the operating system. As there is a variable that return the curent OS name (@qgis_os_name) this is easily done by using an expression like :

CASE
    WHEN @qgis_os_name  = 'windows' THEN 'Arial'
    WHEN @qgis_os_name  = 'linux' THEN 'Liberation Sans'
    ELSE 'Fallback font'
END

in the data defined override of the font selection.


The next QGIS release (3.28) will Add support for "user" fonts, and automatic downloading of freely licensed fonts that will let users populate a list of automatic font replacements to apply when loading projects, add a font folder that provides a way for users to use fonts without requiring them to be installed on an operating system level and automatically download missing fonts in certain circumstances.

So it will get easier to deal with such problem

1
  • I've edited my answer to say QGIS doesn't have a built-in way to choose a font :)
    – Spacedman
    Oct 24, 2022 at 8:44
3

QGIS doesn't have a built-in way to select close-matching fonts if it finds a missing font.

Hence you need to have all fonts (and any other external resources) used available on all systems where you want the project to work.

That means either installing Arial on your Linux systems, and specifying that in your project (knowing its fairly safe that it will be on your Windows systems). Or installing Liberation on your Windows machines and specifying that assuming it will be on your Linux boxes.

Arial can be downloaded via this link, read the license first:

https://www.freedesktop.org/software/fontconfig/webfonts/

As an openly licensed font, Liberation Sans can be downloaded from most font archive sites.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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