Text on Circle Node

john's Avatar

john

20 Aug, 2022 11:30 PM

A new Nodebox user, Julien, recently asked this:

Centering the text path in the middle?

Is it possible to center a text path, instead of just choosing the beginning or the end for alignment? This could be handy for centering variable size text (in my case, the inscriptions on the lens).

A perfectly reasonable request that is harder than it seems. The text_on_path node will create a text path that follows another path, like a circle, but it has no center option. So when you want to center text atop a circle you have to manually adjust the margin as you change circle diameter or font size. This is not hard to do, but it is a small pain, and it prevents you from automatically centering text over circles that dynamically change their size.

Creating a node (subnetwork) to do this is harder than it might seem even if you limit the guide path to a circle. To make the calculations you need to measure the arc formed from the beginning of the inscription to the end, which will vary in a complex way depending on diameter, font size, and which font you use. An interesting challenge!

Challenge accepted! Behold: the text_on_circle node. Give it some text, a diameter, font name, font size, and offset (above or below the circle) and it will create a text path for you. A rather arcane function, but it does come in handy every now and then.

NOTE: see next comment for an improved version!

I will be adding this node to the next release of my node library. Enjoy!

John

  1. Support Staff 1 Posted by john on 25 Aug, 2022 05:07 AM

    john's Avatar

    UPDATE!

    I have improved this node. It is now called Text_Circle.

    • It now has an option to kern the text (adjust the spacing) between the characters and/or between the words. This can make text bent over a circle much easier to read.
    • You can now center the text below the circle as well as above it.
    • I completely rewrote the node and no longer rely on the text_on_path node. Character rotation is now smoother and more consistent.

    Please give this improved version a try and let me know if you have any other suggestions.

    John

    P.S. POWER TIP: To inscribe text inside a circle you can use a negative offset, but this will cause the letters to crowd together a bit. For better results, set offset to 0 and reduce the diameter of the circle.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • text_on_circle_screenshot.png 338 KB
  • text_on_circle.ndbx.zip 3.06 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

01 Oct, 2024 07:59 AM
30 Sep, 2024 11:37 PM
30 Sep, 2024 11:11 AM
30 Sep, 2024 02:37 AM
28 Sep, 2024 10:33 AM

 

26 Sep, 2024 06:41 AM
24 Sep, 2024 12:32 AM
24 Sep, 2024 12:27 AM
13 Sep, 2024 12:07 AM
12 Sep, 2024 11:54 PM
07 Sep, 2024 05:16 AM