Install fonts from within the code

2019-09-08 18:30发布

问题:

I'm currently using a custom font in my XNA game. As you might imagine, the game wont start if the font isn't installed on the PC. I'm planning on using try/catch to understand whether the font's installed or not.

Now, is there a way to install the font from within the code? You can take in mind that the font file is in the Content folder.

回答1:

What you can do is convert your font to a BMP spritefont, import the BMP image and change from "Texture" to "Sprite Font Texture" at the Content Processor in the properties. You can see Here how you can do this.



标签: fonts xna