Archived

This topic is now archived and is closed to further replies.

Coconut

Text engine design effeciency

Recommended Posts

For Font engine, durring initialization, load fonts into Bitmaps by creating surfaces for each character and blitting from the GDI to the bitmaps one character at a time. Put these surfaces in system memory, in an array that is indexed by the ASCI code, with the dd interface pointers as the contents of the array. Durring initiation use a custom class or structure to store which fonts and point sizes for the fonts to store, and then use proper textual spacing as defined in the Win32 font structure to output to the desired surface. Should result in blazing fast textual output, as well as graphical presentability, and the only problem with this system is memory consumed with the font bitmaps that could be used instead for game graphics or memory. I am currently in the process of creating a text engine for my DirectDraw7 wrapper, and I was wondering if the implementation I am currently prototyping is feasible for an interactive graphics application such as a Tile-Based strategy game with medium textual output per frame. This implementation requires more memory than just using straight GDI rendering to a surface, but the performance improvements should be drastic depending on available memory. The idea is for user of the wrapper to specify in LOGFONT structures and in an array of RGB triples the specific attributes of each font their application will using durring the execution of their program. These font''s are then used to blit the image of each viewable character in the ASCI charset available in each font to individual surfaces, whose interfaces are maintained and stored in an internal data structure along with the other miscellaneous text information. Durring the execution of the application, the user would call functions in my surface wrapper that request a drawing of text using a specified font index. This function will then use the information in the text metrics structure to properly print the current font characters using the appropriate spacing and what-not in a system-font fashion. All help would be appreciated! "The computer programmer is a creator of universes for which he alone is the lawgiver...No playwright, no stage director, no emperor, however powerful, has ever exercised such absolute athority to arrange a stage or a field of battle and to command such unswervingly dutiful actors or troops." - Joseph Weizenbaum "Artificial stupidity (AS) may be defined as the attempt by computer scientists to create computer programs capable of causing problems of a type normally associated with human thought." - Wallace Marshal "640,000 bytes of memory ought to be enough for anybody." - Bill Gates, 1981 "Is all what we see or seem, but a dream within a dream?" - Edgar Allan Poe -Brent Robinson

Share this post


Link to post
Share on other sites
Another possibility would be to use one surface for all the glyphs, and use the font sizes to determine which part of the surface is used by the different glyphs. It may not be quite as fast as using a separate surface for each glyph, but then again, you need to use the data for the size of the glyph to space the characters properly anyway, so using it also blit the charater shouldn''t be much of a performance hit at all.


War Worlds - A 3D Real-Time Strategy game in development.

Share this post


Link to post
Share on other sites