Advertisement

BmFont does not includes invalid char glyph in my own font

Started by May 08, 2016 01:37 PM
4 comments, last by WitchLord 8 years, 6 months ago

I have once created a TrueType font with FontForge that defines an invalid char glyph. That works in all programs that I had tried. I tried to load this font and ticked the "output invalid char glyph" in BmFont and it cannot select that glyph correctly.

I do not understand much of WinAPI/GDI it uses but reading the code it seemed that how Andreas reads the invalid char glyph is by selecting the Unicode code point 65535 (0xFFFF) and generates the (vertex based) information for the glyph based on what it gets from that position. For some reason this results in an empty small region. Almost as if the algorithm found literarly nothing. (I asume this affects other fonts.)

I do not know if the font needs something special for this invalid glyph to work or is this just simply a bug. I adopted my font so I positioned it to the -1 position, I also tried to point it to different locations, but BmFont was not able to pick up the invalid char glyph for position -1.

What I would like to ask is what does the GDI and BmFont needs to be able to read the invalid char glyph and generate it correctly in to the resulting bitmap font? What does BmFont is relying on to read the Invalid Char Glyph?

The following is used to determine the glyph index for the invalid char glyph:


// Get the default character instead
TEXTMETRICW tm;
GetTextMetricsW(dc, &tm);
WORD glyph;
fGetGlyphIndicesW(dc, &tm.tmDefaultChar, 1, &glyph, 0);
idx = glyph;

There appears to be a bug in BMFont when not rendering the glyphs from the true type outline though. I'll need to investigate and fix this.

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

There appears to be a bug in BMFont when not rendering the glyphs from the true type outline though. I'll need to investigate and fix this.

That explains it. And setting the font options to use the outline does fixes this. Thank you for you quick response.

And that was the code that I found drawing my conclusion.

I've uploaded a new version of BMFont to the site (1.14beta) that should fix this problem.

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 was using the 1.14 beta (64-bit) version when the problem occured. I have hopefully redownloaded the executable unless I managed to redownload the cached version but the problem still persist: if I don't check to render from the TrueType outline, the invalid character glyph is not present. (I was checking in the visualize window, and couldn't find it.)

It works with the installer version 1.14 beta.

Ah, I didn't update the 64bit version yet. I'll do that a.s.a.p.

Done!

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