• 9
• 9
• 10
• 9
• 10

# BmFont does not includes invalid char glyph in my own font

This topic is 713 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites

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.

Edited by Andreas Jonsson

##### Share on other sites

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.

##### Share on other sites

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

##### Share on other sites

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.

##### Share on other sites

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

Done!

Edited by Andreas Jonsson