Microsoft MakeCode

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!

9 Likes

Are there any other blocks anybody wants in this?

1 Like

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!

2 Likes