bitmap font writer

hi all!

i want to create a fontwriter (dont like the system fonts), however im doubting how i should implement it.
i first created one with a memoryimagesource, i loaded a bitmap into an int array and then had a map to the offsets where each character resides in this int array. but now i want to build it so i can use it with java2d or maybe opengl too. what would be the best approach to build this fontwriter then? should i have individual images for each character? or is there a better way? and would individual images per characyter suck up more resources than having one big image?

thanks!

I’ve used a single image with Java2D. Only issue I found was with the API call that also allowed the background colour to be set. This didn’t work correctly on the Mac for the colour blue. This may be screen format and bitmap format dependent, so you might not see it. This may apply to some of the simpler calls appropriate for individual bitmaps too; I haven’t checked. Just keep an eye open for it really.

With OpenGL, I have tried individual bitmaps with glBitmap (I think, can’t be bothered to check openGL ref book). Note that you can’t scale fonts with glBitmap. You can scale with glDrawPixels, but this resets the openGL pipeline (at least in some cases e.g.), resulting in a very slow framerate. Another good method is to store your font as a texture. In this case you want to put the entire font in a single texture, as otherwise you will have to keep selecting textures in and out.

Overall, I’d probably put the entire font in a single BufferedImage or openGL texture.

Alan