Using/Changing Fonts used in ETC Modes

We have a lot of fun using fonts files, there are few built in modes that do this. Not really an image format, but they are vectorized, and if you knew how to make a font it would be a handy way to do this… I never figured out how to make a font file, but I’m sure it is possible!

Brilliant Idea! Making a font set would be very flexible indeed! Plus there’s plenty of dingbat style fonts out there that might be fun trying as well.

Yeah, there are many font files out there, we really only scratched the surface… let us know if you find any or come up with any of your own!

Hi Owen, to convert SVG to ttf is easy… https://cloudconvert.com/svg-to-ttf. but there are also programs to make a complete font file out of vectors… https://birdfont.org. bought an etc today :wink:

Sweet resource! Now we need a mode which overlays fonts onto a background image. :wink:

so no luck with fonts so far… tried to swap the font.ttf file with some other dingbats and fonts in ttf format in “T - Font Patterns” and “T - Font Recedes” but the etc is only showing blank screen or squares then… did you or anybody get that working?

Bummer! Did you try one of the standard fonts like Verdana or Tahoma?

hey, no just tried randomly a few fonts and dingbats… Spanish flash cards works with every font. it seems that in other modes they use kind a system font(s) for that. maybe sitting in the system on the micro sd?

As a test, I would try a standard font, but something other than times-roman. The regular zapf dingbats or wingdings might be good ones to try. Free fonts on the net can be really janky at times, so confirm you can successfully swap out a standard font first.

all fonts are working but only in modes like spanish cards. in font patterns mode there are fonts embedded (don’t know where, maybe in the os)… you can see it in the main file.

1 Like

Well that’s actually good news since we can build more patches from Spanish cards. Would like to potentially combine images with fonts…

Hi @jani & @mkunoff

Regarding using new fonts with the Font Patterns mode: you can use whatever font you want, but you need to tell the main.py file where to find the unicode characters (glyphs) inside the font file’s table using a hexadecimal number.

Not all fonts have all the same glyphs included, especially those fonts that use uncommon glyphs like the font that Font Patterns uses. (Modes like Spanish Flash Cards use the section of a font’s table which includes Roman/Latin alphabet glyphs have a higher chance of being included in a font )

You can see the function in the Font Patterns for getting random glyphs within specific ranges (eg: set 1’s range is: 0x1680 - 0x169C) of a font table:

If your font does not have any glyphs in these ranges, you will not see anything on screen. You will need to check where your font has the glyphs you want to use (and then update the main.py file). Sometimes a font’s creator will share a list of the glyphs included as well as their unicode number. If not, this is a helpful tool to see where the glyphs are in the font’s glyph table: http://bluejamesbond.github.io/CharacterMap/

2 Likes

Hey Chris, cool thank you for the tip. Now I can load them in font patterns but I need randoms from multiple ranges in one set like 0x30, 0x39 and 0x41, 0x5a if set to 1 and other (multiple) ranges if set to 2 on third knob and so on… would you provide me a code for doing this?

I tried with…

if set == 0 :
# all of them (or a lot of them…)
return unichr(random.choice(range(0x30, 0x39) + range(0x41, 0x5a)))

… the mode loaded but nothing changed except on the first frame I sometimes saw I pictogram of the second range (0x41, 0x5a).

then I tried that (sorry I’m completely noob in python, just copied it somewhere)…

if set == 0 :
# all of them (or a lot of them…)
return unichr(random.randint(*random.choice([(0x30, 0x39), (0x41, 0x5a)]))

the mode did not load.

Hey, let’s see if we can figure this out together. I want to do the same thing. There is a new utility which was just released to display the character set you want to use. https://patchstorage.com/font/

Maybe someone can help us…

My main problem is that i’ve got no experience in python or other languages as well.

So there are a few examples such as that one i’ve found…


…but no luck so far with combining one of them with the font pattern mode.

The prob is that in many fonts the entire range of characters is interrupted with unwanted symbols like the square or often with an “empty” symbol.

Randoms out of multiple ranges would be very handy for the font modes – or maybe there’s just a code to exclude unwanted symbols (ranges) in the unicode palette of a special font file.

Here’s an idea…

Use a CSV file to store a table of character hex values and only randomize the values in the table. You can use the new Font Mode [utility-Mode FONT] to determine the glyphs you want to use. A little more work for the ETC user, but perfect control over which characters are output.

This is a good idea.

a way to exclude unicodes not present like @jani mentioned, problem is I don’t think there is a way to ‘check’ if the character is valid in PyGame, you just ask for the character and get a something back or the undefined symbol. so there will always be a little work up front to make sure the characters you are utilizing are actually present.

We know the unicode hexas of them so python doesn’t have to check. the question is how to tell python with a simple code to exclude the ranges of unicode hexas we don’t like or maybe just tell Python to pick randoms of multiple ranges we want. Maybe it works like with one of that example codes from that stackoverflow link above… with a csv table for each font file it should also be good but i have no idea how to implement that?

an easy way is to just define an array of ranges:

ranges = [(0x1680, 0x169c), (0x2190, 0x21FF), (0x2200, 0x22FF)]

there are 3 ranges here, but define as many as you like, then do this:

range = ranges[random.randrange(0, len(ranges))]
character = random.randrange(range[0], range[1])

the first line chooses one of the ranges from the array, and the second line chooses a number from that range.

1 Like

Awesome! So my plan is to use the new ‘Font’ mode [ https://patchstorage.com/font/ ] to map out the various dingbat fonts I’ve hoarded. Now, to the lab!..