Basically, I'm trying to make a system which replaces tags in text with an image. For example, right here I can Include right inline with the text. I'd like to be able to do something similar to that at runtime in C2, but I've come across a problem.
It's easy enough to identify the tags, read them, replace them with whitespace, etc. But, when I want to insert the actual sprite, I can't actually find the coordinates of the character it should be placed on top of! Basically, after doing the tag processing, I end up with a space character and the index of that character in the text. I simply can't find a good way to translate that text index into an actual coordinate. I suppose it'd be possible to loop through all the characters and add up their individual character widths, but it gets *really* dodgy when line breaks get into the mix. I'd like to potentially support this for regular text, too, and that's even more impossible since I can't even access character widths.
One workaround would of course be just to substitute the icon in for an unused character in the spritefont file itself, but there are a few limitations there. It's a bit of a pain to keep track of (æ = etc) but the biggest issue is that I lose the ability to animate the icon.
Any thoughts?