Custom Fonts Extension

This extension lets you create custom fonts -


rishiporwal/custom-fonts


Here are the blocks -

And an example -

Hope you find this extension useful!

17 Likes

Are there any other blocks anybody wants in this?

2 Likes

Wow!!! This is awesome! :smiley: I’m definitely gonna play around with it, but just off the top of my head, some directions you could take this:

  • Multiple fonts: instead of a global array of glyphs, a block like create font named $name, where each property (letter spacing, glyphs) is attached to that name. My thought here is that someone could create an extension that uses your extension and exports 3 different fonts, eg “Space Font Pack”.
  • Resizing the font: this could be a bit of a perf hit, but @jwunderl has an image scaling extension https://github.com/jwunderl/pxt-scaling that might help
  • Font color: also a little tricky in terms of block design since a glyph can have multiple colors. One approach could be to have a block that sets the font’s “base” color (eg black) and your “create image” block could have a color argument where you set all “base” color pixels to that color.
  • Case insensitive: some fonts (especially for splash screens!) might be all-caps or all lowercase, so you could have a flag for setting “ignore case <true>” where “abc” and “ABC” would both render to the same thing. (Also this means the font creator only has to do half the letters, haha)

You might also consider renaming “create the image of” to “create sprite with text ___” or even “draw text ___” like you have in the comment! Something else that could help the blocks. Setting default values in your blocks can also help clarify their use, eg "draw text hello world" or “set A to [image]” might be easier for someone to read at first glance.

Really incredible work, super excited to try this extension out!

7 Likes

not really a block, but could you make this on micro:bit? it would be AWESOME!

1 Like

Micro:bit has a 5x5 array of LEDs… I don’t see how that would be viable
Also, @GameGod has unfortuneately been inactive on the forums for a very long time

1 Like

@Sarge here is all the good uses for it:

non available characters
fancy text
emojis
glyphs

and if he is offline, ill try to do it (and probably fail)

1 Like

Well, good luck then!

It’s… not working.