2
\$\begingroup\$

While working on projects of mine, I have been finding that it is a huge pain to switch operating systems just to create a simple spritefont when using Monogame. I saw that the Nuclex Framework can load fonts which are clearer/sharper, and they can be used in a Monogame project as well. They load fonts using the FreeType library, which is very multiplatform and is used widely. Is there a fairly simple way to use the FreeType library or another library to render text suitable for use in a Monogame project, as an xnb file?

\$\endgroup\$
1
\$\begingroup\$

From my understanding a spritefont is essentially a collection of sprites where each letter translates to a coordinate on a spritesheet, such as the following:

enter image description here

You can do this manually, of course, but it would be a pain to check each coordinate. You can use BMFont to do the conversion for you, which creates an image such as the one above, followed by an xml file with coordinates to each letter.

I've never done it with MonoGame, but you can find a tutorial here

As far as what you said about needing to switch operating systems to create the file, what do you mean? You can create a content project in MacOS and Windows. Also, MonoGame has been working on the new pipeline using the new Pipeline.exe and related tools

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Yeah, you can create a content project in OSx and Windows, but I develop on Arch Linux most of the time. Thanks for the answer! \$\endgroup\$ – Pip Dec 7 '14 at 14:45
  • \$\begingroup\$ Hmm, so libGDX uses Hiero, which creates an .fnt file just like bmfont. You can find the Hiero github here: github.com/libgdx/libgdx/wiki/Hiero I noticed that it contains a jar file, maybe you can get it going on unix \$\endgroup\$ – PixelCake Games Dec 7 '14 at 18:49
  • \$\begingroup\$ Also, that same github page has several links to other font packaging software, most of them work with .fnt formats. Take a look under alternatives, there are several others! \$\endgroup\$ – PixelCake Games Dec 7 '14 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.