Hi.
I’ve mentioned a text-rendering plugin at least a couple of times, in here and here. This is something I put together a while ago, even submitted, yet have since sat on (it’s available on the Marketplace but still hidden), mostly owing to docs and wanting better examples. Actually, docs will still probably be a big bottleneck with everything that follows.
It’s a pretty low-level library, rendering text as blobs of bytes, basically a thin wrapper over the TrueType component of stb, a collection of useful libraries.
I’ve finally started getting back to it. The library also exposes the intermediate vertices used to render glyphs, which I’ve been getting in order. The geometry is exposed as contours, so I’ve also now bound libtess2 (the same author wrote the SVG library Corona uses). That module might have been a good answer to sporkfin’s question in this topic, but I wasn’t aware of it. :) Since it uses contours as well, I’ve also been binding the Clipper library I mentioned in that same topic, but this still needs testing.
I’ve included a project, with binaries and an example. There are some rendering bits (a scaled string and unscaled “a”, plus a printout in the console) and then the mesh bits: one by one, I etch out a series of characters, both by tracing dots around their outlines, and as geometry. The code is quite messy as I’m still just putzing around in it. The strings used are in there and can obviously be edited. The geometry mode can be toggled between “BOUNDARY_CONTOURS” and “POLYGONS” to tessellate in the appropriate way (in theory the connected polygons mode should work too, but I haven’t tried porting it). This is still very much a WIP with other options left to explore.
(Unfortunately, since the plugin needs to read the font, it’s subject to pathForFile’s gotchas on Android, thus the text files in the example.)
If you’re on Windows and any of this sounds remotely interesting, you can take the DLL files from the binaries
directory and drop them into a plugin folder that you create at this location:
print(system.pathForFile("", system.PluginsDirectory))
I think Bytemap is still the same as the Marketplace version, but GlyphRenderer currently isn’t, so comment them out from build.settings accordingly. I don’t have Mac builds yet.