What would be the simplest way to write text to a texture?
I imagine that it could be done by creating a new camera, placing the text in OnScreenText objects as desired before that camera and then rendering that to a texture, but that seems to me to be a slightly long way around for a fairly simple operation. Does anyone have any simpler suggestions?
You can try PNMTextMaker.
Ah, that’s wonderful! I don’t think that it even occurred to me to look for so direct a solution - thank you!
I am having a problem, however: what filename or font information do I give to it? I tried a few font names (“Arial”, “Courier New”, etc.) to no avail, and I don’t know where to get the “font_data” requested by the other constructor.
You need a font file (but not a Panda egg font). All operating systems come with some collection of font files. Typically these are .ttf files nowadays, but other extensions are also seen.
Typically the font files that ship with your operating system are copyrighted and you won’t have permission to include them with your game, but you can find free font files on the net by Googling for them.
Ah, thank you - I seem to have it working now. I was assuming that I could reference a system-installed font without a file path; I downloaded a free font, placed it in a sub-folder of my project and referenced it via that path, complete with “.ttf” extension, and seem to have working text now.
Thank you again!