Add_Unicode!

john's Avatar

john

29 Dec, 2024 12:06 PM

One more addition before I publish v3.5 of my library... unicode!

The unicode node is very simple. Just enter one or more 4-digit unicode hex codes (separated by spaces) and it will spit out unicode characters, ready to work with. The only catch is that it does require a Python module: unicode.py (included).

You can look up the codes you need in Wikipedia: https://en.wikipedia.org/wiki/List_of_Unicode_characters

There are over 155,000 to choose from.

And in case you want to insert one or more unicode characters into a normal string, I have added a second node: add_unicode.

To use this enter your string in the prompt, and wherever you need a unicode character, just add "U+hhhh" where hhhh is a 4-digit hex unicode code point. Those 6 characters will be replaced by the appropriate character. You can have up to 9 unicode characters in a string. (It's easy to add more if you ever need to.)

The attached demo shows both nodes (see screenshot).

On the left I simply enter 6 codes into the unicode node's hex code(s) port to produce 6 music symbols. On the right I create an "I Heart NodeBox" text path using one code for the heart and a second code to add a superfluous Breve mark over the second 'o' in Nodebox. To turn the heart red I added tildes around the heart code and fed it into my style_text node instead of a textpath node. Since style_text produces a list of separate words I had to use a stack node to bring them back together.

I'm sure you can think of many possible uses for unicode characters in NodeBox. In addition to creating musical notes and rendering many alphabets from around the world, they can create mathematical symbols, easy superscripts and subscripts, arrows, geometrical symbols, wingdings, and glyphs that can serve as the basis for more elaborate shapes or paths.

In the library I will just show the add_unicode node and include the more basic unicode node in the demo.

Library v3.5 coming soon!

P.S. For more info about unicodes and how to use them, I strongly recommend this article; https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-ever...

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

  • unicode_screenshot.png 430 KB
  • unicode_demo.zip 8.59 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

26 Jan, 2025 02:09 AM
24 Jan, 2025 07:50 AM
22 Jan, 2025 11:42 PM
21 Jan, 2025 09:43 AM
21 Jan, 2025 09:41 AM

 

21 Jan, 2025 09:36 AM
21 Jan, 2025 02:00 AM
16 Jan, 2025 08:30 PM
15 Jan, 2025 06:37 AM
04 Jan, 2025 04:09 AM
03 Jan, 2025 05:32 PM