Creating custom font types

Started by
14 comments, last by prh99 18 years, 9 months ago
The OP seems to have an issue with the idea of a "second stage" in the drawing process - conceptually, he wants to just set the pixels on the screen, not set them in a texture then use that to set the screen. I could be wrong of course - this is just the impression I get from the question.

Basically, what makes you think that passing a value for each pixel on the screen which you want to set, individually, in order to form a letter, will be more efficient than making an array of such pixel values and then passing that in one big lump? Generally passing one big lump of data will be more efficient.

These 2 dimensional arrays of pixel values which we like to pass around are sometimes referred to as textures. Just for convenience.

Advertisement
Quote:Original post by Dean Harding
**snip**

Yes that is what I meant, sorry for any confusion. Mind you I have never looked at the Word source code, so my explanation is strictly just most likely how they went about displaying text. I did however do quite a bit of work creating an ide style text editor from scratch (without a canned edit view as I wanted more flexibility for coloring syntax and such). Doing this it readily became obvious that re-rendering the screen every time a new character is typed was far from practical as it caused a very unsightly flashing on the screen. Mind you I could have solved this with a double buffer system, however that seamed like an inefficient approach when in reality only a small portion of the screen needed to be updated. So thus is why I theorize Word uses such an approach. Once again, I could very well be wrong; however the main point anyway is that the GDI in its raw form (without using some optimization trick) is a slow beast, and not well suited for the demands of games IMHO.
Thanks for the replys. I am wondering is a buffer an array? or something else?
Most of the time a buffer is an array, however not always. A true buffer is just any data structure that works as a temporary place for data to sit as it moves from one place to another. A good example is when working with c style strings (character arrays) often times one will do something similar to the following:
char buffer[256];sprintf( buffer, "Some formated text %i", some_int );font.write( buffer, x, y, 0xff00ff00 );


Here the 'char buffer[256]' acts as a temporary storage space for the formated string as it moves to the screen. Most likely this is the type of buffer you are referring to, in which case it is an array. The classic CS example of a buffer that is not an array would be a print queue.

Hope that helped.

(Also hope you notice this, as it is a few days late in coming)
Thanks everyone for the help.
Quote:Original post by GameMasterXL
I was wondering this morning if it was possible to creat your own style of font to be used by any program that allows it? like i am wanting to creat my own font style for my game so i don't need to load bitmap images that will take more memory.


I found FontForge, and open source font editor capable of making TrueType and OpenType fonts (among others). I haven't tried it but it is free and the screen shots look promising.

Hope this helps.
Patrick

This topic is closed to new replies.

Advertisement