2

I've just opened a feature request, but maybe someone knows a temporary solution.

In QGIS 2.2 one can change the default font of the Print Composer (through the Menu Option -> Setttings). But I think it is not possible to do the same with labels.

This is a little bit boring when one has to export a project from a Linux to a Windows machine. In Linux (debian in my case) the default font in Cantarell, font that is not recognized by Windows. This cause a boring error message. No big deal, just annoying.

Thanks

  • Did you ever find a solution for this? Would be very worthwhile! – Simbamangu Dec 8 '14 at 15:59
  • Hi @Simbamangu, unfortunately not yet. If you take a look at the link of the feature request you will see that it is still open. – matteo Dec 9 '14 at 10:56
3

As a workaround (or even a solution) you can create a variable (project or global based) with the default font - maybe one that is found on both OSs?

To do that, you can create either a project based variable (only applies to that project) or a global variable (applies to every qgis project).

To make a global variable, click Settings > Options > Variables (pane on left).

To make a project based variable, do this through Project > Project Properties > Variables.

Once you decide if you'd like a project or global variable, hit the green + sign, and for example, make a variable called def_font and with the value Comic Sans.

def_font Comic Sans

Now you can use that variable as the font through a data defined override (expression). See screenshot below where that variable can be applied from Layer Properties > Label (tab)

font variable usage in qgis

Now that variable can be applied to each layer that would use that font, and if you ever need to change the font (for those 20 layers!) just change the def_font variable and voila - it updates all layers referencing that variable.


The above example shows how to change the font face/family but other variables can be created for other font styling changes like bold, size, placement, etc.

  • it is possible thanks to the Variable introduction in the last QGIS releases. but, in fact, this is the solution to an old problem – matteo Mar 24 '16 at 22:27
  • Doesn't work for the print composer labels unfortunately – Damien Aug 30 at 4:55

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.