PocketMatrix forums

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

Problem with advanced font format

I've tried to use the advanced font format but it keeps giving me errors... would anyone be able to help me?

Code:

Verdana8.CreateSurface(TEXT("Verdana8.gif"));
Verdana8.SetColorKey(RGB(255,0,255));
Verdana8.CreateFont(0, NULL);


The first two function calls return 0 (GD_OK), but CreateFont() returns 0xc8660070 (GDERR_INVALIDBITMAP). I've already tried everything, but the error keeps happening.

Verdana8.gif is a white and magenta (RGB(255,0,255)) image generated with the MetalShard FontMaker. I don't think the problem lays on it because the file loading (CreateSurface) returns GD_OK...
Since I've not worked with GIF format images in GapiDraw (I only use PNG format) I would first verify that isn't the problem. Here's my code for creating a font:

Code:


HRESULT hr = m_cScoreFont.CreateSurface(hInstance, IDR_SCOREFONT, TEXT("PNG")); if(hr != GD_OK) return hr;
hr = m_cScoreFont.SetColorKey(TRANSPARENTCOLOR); if(hr != GD_OK) return hr;
GDFONTFX ffx; ffx.lTracking=1;
hr = m_cScoreFont.CreateFont(GDCREATEFONT_TRACKING, &ffx); if(hr != GD_OK) return hr;



I always use kerning marks in my fonts, thus the tracking value. Hope this helps...

-- GR
Ok, tried everything just like it is in that code snippet you gave me, but still it doesn't work.

By the way, it's not a good idea to "always use PNG". It is really a wonderful format for game graphics, but we need to watch out it's use. Verdana8.gif is 1.19kb, while Verdana8.png (8bit) is 1.23kb. I know it is a tiny difference, but that's only to show that, when talking about palletized 8bit images, there is no better choice other than GIF. I use PNG only for 24bit images. :)
Did you check that the GIF format wasn't the problem?
Justt:

Please read through the documentation thoroughly. You may need to modify the font generated by the FontMaker program to make it work.

PNGs are a better choice than GIFs since from GapiDraw 1.10 and onwards they use minimal amount of memory overhead when loading onto surfaces. This is because a modified version of LibPNG is now linked into GapiDraw on all devices.
There are also PNG stripping programs out there that'll strip unnecessary portions of the PNG format from the file thus making it smaller so the size issue becomes a mute point.