I'm designing a secret writing system for tabletop games where each word becomes one glyph. The letters are arranged on a grid, and the glyph is created by drawing a line from the center of each letter to the center of the next, similar to swipe typing on a phone.
I'm trying to account for special cases such as the beginning and end of a word, repeated letters, letters that fall in a straight line with the previous and next letters, and crossing lines. I'm also considering an outer circle around the grid to make the encoding unambiguous.
I have only limited experience with Python and R, so I'm open to using whichever language or library is most suitable. My planned process is to assign coordinates to the grid letters, split the input into characters or words, convert each character into coordinates, draw the connecting paths and any special markers, and export the result as a transparent PNG. The parts I'm unsure about are drawing the paths and exporting transparent images. What would be a good place to start?
4 Answers
For a Python prototype, define a dictionary mapping each letter to an (x, y) coordinate. Iterate through the word, keep track of the previous coordinate, and call the drawing library’s line function for every successive pair. Special symbols can be drawn afterward at the relevant coordinates, using white or transparent-filled shapes to interrupt lines where necessary. Once the figure is complete, save it with a transparent background, for example through Matplotlib’s transparent export option.
You’re essentially working with vector paths: store the coordinates as numbers, move through them in order, and stroke a line between each pair. A canvas library such as Python’s Matplotlib can draw the lines, circles, and other markers, then save the result with a transparent background. SVG may actually be a better intermediate format than PNG because it preserves the paths and transparency without losing resolution. You could generate one path for each word and place the resulting glyphs next to one another for a sentence.
Another option is to turn the system into a font. You could generate or draw the glyphs as SVG files and use a font editor to package them into an OTF font. Then normal text layout handles spacing and placing the glyphs in a sentence. This works best if you have a fixed, manageable vocabulary; if the glyph for every possible word is generated dynamically, a path-drawing program will be more flexible.
So the font approach would mainly be useful if I want the glyphs to behave like characters inside regular text, rather than generating each image separately?
Before implementing the renderer, test whether the encoding is uniquely decodable. Different letter sequences can sometimes produce the same geometric path, especially when lines overlap, retrace themselves, or pass through an intermediate point. An explicit start marker, end marker, repeated-letter marker, and a rule for intersections can help, but it’s worth writing a small decoder or collision test to verify that two different words never generate the same glyph unless that ambiguity is intentional.
A little ambiguity could be acceptable for a game, but checking for collisions would still show which words might be confused and whether the outer boundary solves the problem.

That makes sense. I hadn’t considered using SVG first, but keeping the coordinates as paths sounds easier than working directly with pixels.