Trouble with Bitmap Font transparency, both with vanilla Monogame and Extended's BitmapFont

So I recently decided to convert my XNA game over to Monogame. It was surprisingly easy, but the only problem I have is getting bitmap fonts to display correctly or work at all. My game is low resolution so bitmap fonts are the best choice.

If I try to display them just like in XNA, the parts of the text that are supposed to transparent are not, so the black boxes behind the text appear. I tried several different combinations of BlenderStates, as well as the importers and processors in the Pipeline tool. Either there was no transparency, the program wouldn’t even run, or all of the text was partially see-through but the black boxes were at least gone also.

So I gave up on that and tried using the BitmapFont class from Extended. With this method I can’t get my program to run at all. Either the pipeline tool fails to successfully build the font, or I get an exception error because it can’t convert a BitmapFont into a SpriteFont.

If I had to choose, I’d rather not use Extended’s BitmapFont, since (for some reason) the MeasureString function can’t use the X and Y values with BitmapFonts, since it needs Width and Height instead. That’s a lot of changes to my code I’d rather not have to make.

I’m using Monogame 3.8, if that matters at all.

Looking online for a solution just brings me to the same handful of pages, and none of them really seemed to help me in any way. This is the first time I’ve had to ask a question myself to get help. I’m just truly at my wit’s end.

(for some reason) the MeasureString function can’t use the X and Y values with BitmapFonts, since it needs Width and Height instead.

The API for MonoGame’s SpriteFont.MeasureString gives you a Vector2 but it’s really a size; the X is the width and the Y is the height.

You can see a working demo of bitmap fonts: https://github.com/craftworkgames/MonoGame.Extended/blob/develop/Source/Demos/Features/Demos/BitmapFontsDemo.cs

You could use this online tool to either copy over your bitmap fonts or copy it in then turn it into a ttf.
https://www.pentacom.jp/pentacom/bitfontmaker2/
Once you have it in a ttf you can just double click it to instal it to your system.
Then use the monogame pipeline too to create a font and just open up the file and type the name of that ttf you just made and installed in the spot for font name. save build and load it thru the content manager.

Basically just find a tool that turns your bitmaps font into a ttf and its easy mode from there.
ttf’s can actually hold bitmaps and basically just wrap them.

You can set point or pointclamp state to make the spritefonts appear sharp when drawing.

public SamplerState ss_point = new SamplerState() { Filter = TextureFilter.Point };
public SamplerState ss_point_clamp = new SamplerState() { Filter = TextureFilter.Point, AddressU = TextureAddressMode.Clamp, AddressV = TextureAddressMode.Clamp };
Draw(..){...
GraphicsDevice.SamplerStates[0] = ss_point_clamp;

then use the scale vector in spriteBatch draw to make the letters look large pixelated and blocky. It’s easier to make a ttf look like a bitmap then it is to go the other way around.

Sorry for the long silence, weekends are my busiest times.

I know all about PointClamp, it’s the only SamplerState I use in my game. While all objects on-screen may be moving by float values, I display everything at a solid integer position so that everything on-screen clicks into a pixel-perfect place.

Well I tried to use a ttf instead, but as usual the pipeline tool keeps failing when loading the font. I’m not really sure which importers/processors to use, or if I’m missing something else entirely. I’ve tried all logical combinations and they all end in the pipeline tool failing.

I don’t need to see any more code snippets, at this point the compiler isn’t even reaching any of my code. What I really want to see if more screenshots of the Pipeline Tool, since this is the only new thing I’m dealing with now that I’m using MonoGame. I keep seeing mentions of xnb files for some (not all, mind you) tutorials on spritefonts for MonoGame. I just…can’t find any consistent information on how to implement the pipeline tool. Everything’s usually “just add your content, bing bang boom, good to go”, which clearly is not the case.

I just find it funny that all other aspects of audio, graphics, and input worked perfectly fine once I transferred from XNA to MonoGame aside from the one BitmapFont problem. Is there really no way to just force the pipeline tool to read the BitmapFont in the DXT3 format (like XNA does) instead of the DXT1 format that doesn’t allow transparencies?

If it’s not broken, don’t fix it.

Check the docs, http://docs.monogameextended.net/Features/Bitmap-Fonts/

Well I tried to use a ttf instead, but as usual the pipeline tool keeps failing when loading the font.

Did you try to just load a regular system font to see if that worked.
What is the error visual studio is giving you ?
.
.

LithiumToast: that BMFont tool was not working out for me. I used https://www.pentacom.jp/pentacom/bitfontmaker2/ to make a ttf of the font I want, and tried to use that ttf with BMFont. The letters in my font are 5x9 pixels big, and when I tried to make the font of that size, it just looked plain bad. I could get the right pixel height but it always had the width short so the letters looked jumbled and broken. Also, needing a font description xml along with the font bitmap seems to defeat the purpose of bitmap fonts. I want to be able to just open the bitmap and manually change the size and appearance of the letters at my leisure, if needed.

willmotil: I got my custom ttf to work properly. Only thing left is to have it work without the ttf being installed on my computer. No point, otherwise.

Sorry I’m being so picky, but my game runs in 480x270, then is blown up by a solid integer value to best match the current screen resolution. This isn’t a situation where I can just pick any old font and run with it. I want to be able to craft the font pixel by pixel.

Edit: Allright, got the ttf to work without installing. Thanks for the help!