Variable fonts support

Is there any way for Natron to manipulate variable fonts? I’m using the open source Golos Text font which has the weight variable which can be changed. I want to animate the weight being changed (as below) but that variable isn’t shown in the Text node.

variable_font

Is there any way to use variable fonts or should I file a feature request?

The text node uses Pango, if it’s possible depends on Pango.

Based on Variable Fonts support - Inkscape Wiki it seems to be possible(?).

After a lot of frustration I can confirm that pango can render variable fonts. I’m using linux. First use fc-list to get the name of the installed font

fc-list | grep Golos
$HOME/.fonts/Golos-Text_VF.ttf: Golos Text VF:style=Text Regular,Regular
$HOME/.fonts/Golos-Text_VF.ttf: Golos Text VF
$HOME/.fonts/Golos-Text_VF.ttf: Golos Text VF:style=Black
$HOME/.fonts/Golos-Text_VF.ttf: Golos Text VF:style=Medium
$HOME/.fonts/Golos-Text_VF.ttf: Golos Text VF:style=DemiBold
$HOME/.fonts/Golos-Text_VF.ttf: Golos Text VF:style=Bold

Then I can use pango-view to view the font with variable weights
pango-view --text=test --font="Golos Text VF @wght=1000"

This will show the output in a tiny window.

I have no idea how to render/change text using “vanilla” pango tools so I looked into using it with imagemagick instead

convert -background lightblue -fill blue  -font "Golos Text VF" -pointsize 72 pango:'<span weight="600">100 weight</span>' 100_weight.png

100_weight

convert -background lightblue -fill blue  -font "Golos Text VF" -pointsize 72 pango:'<span weight="1000">1000 weight</span>' 1000_weight.png

1000_weight

So pango can do it but it’s just about exposing this to Natron. Worth noting that there’s more than just the weight attribute that can be varied.

Use Pango Markup in the text node:

Tick markup and add the following markup:

<span font="Golos Text VF @wght=1000">Enter text</span>
1 Like

Brilliant, thank you!

Is there any way to expose this value as a slider so that I can animate it?

A PyPlug could be made. On slider value changed replace/change the content of text in the text node.

PyPlug example (quick-and-dirty):

2 Likes

Thanks for this! This is definitely better than my attempts at battling with imagemagick and pango!

weights=1 ; while [ $weights -le 1000 ] ; do convert -size 1920x1080 xc:white \( -gravity Center -size 1920x540 -background none -pointsize 120 pango:"<span font='FreeSansBold' weight='$weights'>example</span>" \) -gravity Center -composite weight_"$weights".png ; weights=$(($weights + 1)) ; done

That works too, whatever gets the job done :slight_smile:

ha, yep! Both work but your solution means I don’t have to leave the Natron workflow. I’ll still clean up my bash script for folk that don’t use Natron or who want to create animations by piping in a text file.

Here’s what I created with your pyplug btw

I created a glitchy variable font and creating animations using a preset wordlist.

1 Like

Cool.

Btw, you can also use pango markup in ImageMagick, just use “pango:MARKUP_HERE” as input.

That’s what I did in the above bash script. The main difficulty was centering the text horizontally and vertically. Using gravity -center with label: works but when using pango: instead it only centers it horizontally.