Distributing sprite-fonts in MonoGame libs

Hello,

I’m writing a GUI extension for MonoGame (almost done, coming soon :slight_smile: ) and I have a great dilemma on how to distribute the spritefonts.

The extension comes with a few built-in themes, and they all relay on some non-standard free fonts (eg fonts distributed under CC etc, but are not installed on windows/linux by default). So distributing the spritefont files themselves means the program won’t compile until the fonts are installed. So my two options are this:

  1. Include the spritefonts content + the fonts themselves, and add an installation step telling the user he needs to install those fonts.
  2. build the fonts on my machine, and include only the output file in the extension content with “copy” instead of “build” operation (will that work?).

Anyway - thoughts? what do you think is the best way to distribute extensions with spritefonts using non-standard fonts? Maybe there’s a third option I’m not aware of?

Thanks,

You could include the xnb files as a resource and use the ResourceContentManager to load them.

1 Like

Hi @KonajuGames thanks for the reply.

I didn’t know ResourceContentManager existed… I found this tutorial https://blogs.msdn.microsoft.com/shawnhar/2007/06/12/embedding-content-as-resources/ but its kinda old and it talks about creating a “Windows Game Library” which I didn’t find in monogame.

Do you know by any chance projects that use ResourceContentManager that I can look at how they used it?

Thanks :slight_smile:

MonoGame embeds some assets as resources. While we don’t use ResourceContentManager to read them, we embed the standard shaders into the assembly.

We don’t have a Windows Game Library. Just use a standard Class Library to follow that tutorial.

I’ll try that, thanks!