Custom Font with VSTGUI4

Hi Friends,

Is it possible to use custom font (added as say a …ttf or .otf resource) for controls say for CTextLabel ?
Could not find anything in the documentation.

Thanks a lot

I found some reference here…

1 Like

there’s partial support in the latest release. It’s working for macOS, Linux and the latest Windows 10 version, Windows 7 is not supported. For Windows, you need to use at least the Windows 10 Creator Update SDK for compilation.
After that, you just need to place your fonts into a subfolder named “Fonts” inside your Resource directory (so you need to use the package structure for your plug-in). And then you can use these fonts by name in VSTGUI.



What needs to be done specifically to get custom fonts working without the user having to install them in their system?

1 Like

The font must be in a subfolder of the resources folder:

1 Like

Have you confirmed that this really works on Linux? Because it doesn’t for us and we suspect a problem in the sdk.

Last time I checked it worked perfectly. You can check this yourself by building the standalone lib and its examples. The “Standalone” example loads a custom font and displays it.

It looks like that issue we had was fixed with Font rendering using Pango on X11 by jpcima · Pull Request #192 · steinbergmedia/vstgui · GitHub

I have used the following way in Windows:
Add in the *.rc file the following entry the name of your font,
such as DS-DIGIB.TTF.

#define digitalfont 2010
digitalfont FONT “DS-DIGIB.TTF”

The number 2010 is any resource id number.

Then double-click the font file so that Windows opens it for you and note the INTERNAL font file name, once done enter the
the following entries in your uidescription file :

< fonts >
< font font-name=“DS-Digital” name=“digitalfont50” size=“50”/ >
< font font-name=“DS-Digital” name=“digitalfont30” size=“30”/ >
< font font-name=“DS-Digital” name=“digitalfont25” size=“20”/ >
< font font-name=“DS-Digital” name=“digitalfont10” size=“10”/ >
< /fonts >

where DS-Digital is the internal font name.

The above is a method of using different font sizes of the same font and they can be used directly as font=“digitalfont10” wherever a font name is required.

1 Like