I have a project where I need to take input text and render it to an image. The text needs to be wrapped, have margins, kerning, letter spacing, specific fonts, and so on. It seems like I could write most of this by hand, but it also seems like something that there should be pre-existing libraries for.
I've looked at web rendering engines like WebKit and Gecko that seem too complex, LaTeX doesn't seem to have a C++ API, GhostScript looks the most promising so far.
I'm writing the app in C++, and I don't want to have to shell-out to a system call--it seems like that will be inflexible and non-performant. It needs to run on Linux, and preferably Mac OSX too.
Thanks for any advice you can offer.
Subprocesses can be pretty awesome, but I guess you are looking for something like pango or the font rendering engine in Qt. It looks like you can achieve everything you need with QPainter::drawText(...). See also QFont.
It is worth noting that I have dragged in Qt specifically for font rendering before, without using it for anything else. It needs you to create a QCoreApplication-object, but that's it. Works like a charm :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With