unicode sprite sheets with photoshop

automating photoshop with javascript
permalink

My current project uses text glyphs as graphics for the game world, an approach that works very well for small numbers of glyphs and for text-based consoles. I'm using neither, though. I need a lot of glyphs, eventually 2,000 or more, and am developing in Unity3D. Unity's text-drawing capabilities could probably be coerced into something like a textual console, but generating the needed glyphs is simple with Photoshop.

Photoshop supports scripting via JavaScript. My script works by creating a blank document, reading in a list of Unicode characters to draw, and proceeding to move from the upper-left to the lower-right while creating and merging a new text layer with the appropriate glyph. The script also generates a C# file containing a mapping from each Unicode code point to its sprite index. It's easy to extend it to apply custom styles to the final product as well, such as signed distance fields. The script as-is only supports code points up to 0xffff.

Download the public domain script tested with Photoshop CS3.

previously