Jump to content
  • Advertisement
Sign in to follow this  
jadaml

BmFont does not includes invalid char glyph in my own font

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement

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 this post


Link to post
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.

Edited by jadaml

Share this post


Link to post
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.

Edited by jadaml

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!