Basically, for our college project, we need to use a font in xna. The only problem is that we are not allowed to install it due to admin rights.
Is it possible to use and load the .xnb file that gets created as the font. Using spritefont gives errors as it searches for the font in windows.
(The .xnb file will be created on someones personal machine beforehand.)
.spritefont
gives error because its not compiled to.xnb
. You could also use a spritesheet with a font, here is how I do it: code image. I made that spritesheet using BMFC tool \$\endgroup\$Font.Initialize()
in yourInitialize
andFont.Texture = Content.Load<Texture2D>("FontSprite");
in yourLoadContent
method. Then you can callFont.DrawString(spriteBatch, "my text", 1.15f, new Vector2(100, 200), Color.Snow);
in yourDraw
method. \$\endgroup\$.spritefont
to.xnb
but it seems like it requires XNA 4.0 installed, so that you have the content pipeline dependencies set. \$\endgroup\$.xnb
is acompiled
file, so no, of course you can't edit it. What would the purpose of it be then. What I showed you has nothing to do with.spritefont
or.xnb
. It is how you could use an image as a font. \$\endgroup\$