I want to make it easier for people to change fonts without going into the geometry nodes editor.

But I don't know how to select the "String to Curves" node.

Hovering mouse over the node shows me how to change alignment.

bpy.data.node_groups["Geometry Nodes"].nodes["String to Curves"].align_x = 'CENTER'

enter image description here

But if I hover over the font section of the node, it shows this python code, which doesn't work

bpy.data.fonts["Bfont Regular"].name

There is code online to load a data font

data_font = bpy.data.fonts.load('C:\\WINDOWS\\Fonts\\Font.ttf')

But I don't know how to select a specific geometry node and apply the font to it.


1 Answer 1


There are a few bits to this:

  • Select the object that has the Geometry Node modifier. I'll use the active object in my example. If you don't want to use the active object you'll have to change the first line.

  • Select the Geometry Node modifier on that object. I'll search by name, but if you've changed the name of your modifier you'll need to use your name in your code. It's actually better to search by type if you have multiple modifiers.

  • Select the node group from the modifier.

  • Select the String to Curve node from the node group. I'll search by name, but see above.

  • Finally, set the font member of the node. You can learn what member by looking in the manual for bpy.types.GeometryNodeStringToCurves

Here's the code, without any error handling. You should check to see that there is an active object, that it has a modifier, and that there is, in fact, a String to Curves modifier if you want more robust code..

import bpy

obj = bpy.context.active_object
modifier = obj.modifiers["GeometryNodes"]
node_group = modifier.node_group
node = node_group.nodes['String to Curves']
data_font = bpy.data.fonts.load('C:\\WINDOWS\\Fonts\\Font.ttf')
node.font = data_font
  • 1
    $\begingroup$ Works perfectly. Thanks. $\endgroup$ Commented Mar 14, 2022 at 16:44
  • 1
    $\begingroup$ You're welcome. $\endgroup$ Commented Mar 14, 2022 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .