Advertisement

BMFont bug

Started by March 04, 2005 11:40 PM
15 comments, last by Sly 19 years, 8 months ago
Hiya WitchLord. It's me again. The one known user of BMFont (or so it seems) :) How is the investigation going into the previous bug I reported (Tahoma not being available in the font list) and suggestion (being able to output a 32-bit TGA with the font image in the alpha channel)? I know you've been busy with AS 2.0. I am having trouble with one font that gets the first or last column of pixels cut off from some characters (particularly 'o' and 'O' characters). Here is a sample of the output by BMFont with some of the problem characters highlighted. The font I used is available here. Would you perhaps be willing to release the source to BMFont so I could try fixing the bugs here?
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
I'm sorry that I didn't fix the Tahoma bug earlier. I had some time over today and decided (because of your post today) to take a look at the problem. It turns out that the fix is quite simple, just show the face name instead of the full name when enumerating the fonts.

I downloaded the font you used, but I haven't been able to reproduce the problem with the cropped characters. What settings are you using (font size, aliasing, etc)? Does the problem show up in the preview window?

I'll see if I can't implement the alpha channel output today as well. It shouldn't be that difficult.

About releasing the source code. Yes, I've been thinking about open sourcing the project, but I'm not ready to do that just yet. We'll see when that will be.

Besides I just let a guy have the source code for a small donation, thus it wouldn't be right to release the code for free so soon after. Though I did tell him that I had plans to open source it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
I use it too! Good tool.

John B
The best thing about the internet is the way people with no experience or qualifications can pretend to be completely superior to other people who have no experience or qualifications.
It's possible that it is a problem with GDI. What OS are you using?

If it is indeed the GDI that is outputting the characters cropped, then I may have to implement a work around for those cases.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I didn't manage to reproduce the cropping bug, but I decided to release a new version of BMFont today anyway. Version 1.1 is now available with the following changes:

- The font list has been corrected. (e.g. Tahoma is now shown instead of Tahoma Bold)
- The output texture can be saved in both 8bit and 32bit TGAs. For 32bit TGAs the font data goes into the alpha channel and the color channels are set to white.
- The character spacing is now also adjustable. The spacing can be set to 0 to save space, or set to a larger number to minimize artifacts in texture filtering.

I'll come back with a fix for the cropping bug as soon as I can figure out what is happening.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks for the quick response. The new 32-bit texture option works well.

I'm still getting the first or last column of pixels cut off some characters as shown in the original post. That sample was done with the BeinetCondensed font at a size of 24 and anti-aliasing set to 1. I'm using Windows XP with SP2.

If I use an anti-aliasing value of 2, then problem goes away. But then I get single pixel horizontal lines in characters like 'H' and 'F' appearing fuzzy from the anti-aliasing.
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
Advertisement
Strange, I use WinXP SP1 and this is what I get using the same settings:



As you can see, there is no cropping error. I doubt it has anything to do with SP2, but who knows. Have you tried generating the font on another computer?

Anyway, you can use the font I generated if you wish. The files are here: bc.fnt, bc_00.tga.

Even more interesting is that it doesn't always crop the characters on the same side.

Even if I increased the size of the rectangle drawn to not crop the characters, I don't think it would provide a good result since the character spacing would still be irregular.

I'll see what I can do.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

A side by side comparisons gives some interesting leads:



It looks like when your font was generated the font is off by a half-pixel or so. Which is especially visible on the rectangles for the non-visible characters.

Maybe I can find a way to allow the user to adjust this offset manually.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

One thing I just thought of. Do you have ClearType font smoothing enabled in Display Properties/Appearance/Effects? I have it enabled because I work with LCD monitors. I thought of that because the anti-aliasing in those images looked different. I cannot test this theory at the moment because I am at work.
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
I have only enabled the normal font anti-aliasing in XP, i.e. no ClearType.

I think you may have nailed the bug with this one. From what I read and understand of ClearType this is likely the cause of the cropped characters.

I'll have to experiment with this when I get home. I'll probably have to add a warning to turn off ClearType, if I can't find a way to turn it off automatically while drawing the characters in the texture. I hope there is at least a way to detect that ClearType is turned on.

In the meantime, maybe you can turn off ClearType when generating the font textures.

Regards,
Andreas

[Edited by - WitchLord on March 8, 2005 8:37:34 AM]

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement