PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Font Problem

Argh, it seems like invalid fonts pop up every so often...

Attached is a font that I'm getting an GDERR_INVALIDBITMAP error for. Here's the loading code, nothing unusual:

Code:

if (FAILED(pFont1.CreateSurface(NULL, hInstance, IDF_VERDANA_10_BOLD_BLACK, TEXT("FONTS")))) {
MessageBox(NULL, TEXT("pFont1.CreateSurface() Failed"), TEXT("Error"), MB_OK);
}
if (FAILED(hr = pFont1.CreateFont(NULL, RGB(255, 128, 255), NULL, NULL))) {
if (hr == GDERR_INVALIDBITMAP) { MessageBox(NULL, TEXT("pFont1.CreateFont() Failed"), TEXT("GDERR_INVALIDBITMAP"), MB_OK); }
if (hr == GDERR_OUTOFMEMORY) { MessageBox(NULL, TEXT("pFont1.CreateFont() Failed"), TEXT("GDERR_OUTOFMEMORY"), MB_OK); }
if (hr == GDERR_SURFACELOST) { MessageBox(NULL, TEXT("pFont1.CreateFont() Failed"), TEXT("GDERR_SURFACELOST"), MB_OK); }
}

It fails on the CreateFont call, CreateSurface is fine. I plugged the font into the Simple sample app, and it displays the text as gibberish (no error checking during font loading, so it's getting loaded but then not displaying properly).

Anyone see the problem? The font was created with FontMaker by the way. Thanks!
Attachments:
font_verdana_10_bold_black.png
Heya Frank,

The problem is that you were using kerning marks in your font along with the GDCREATEFONT_SIMPLEBITMAP flag in CreateFont(its the default).

Simply remove the kerning marks for the simple font, or add the GDCREATEFONT_TRACKING flag for the advanced font format. =)
Argh, thanks G.R.! For some reason I thought GDCREATEFONT_TRACKING was the default... Did this change between 3.0 and 3.01 by any chance? The code in K&G; Arcade doesn't have the flag, but all my fonts do have kerning marks.