Creating custom font types

Started by
14 comments, last by prh99 18 years, 10 months ago
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.
Advertisement
Just find a program that allow you to create truetype fonts and you're done. It is a tedious task but can be rewarding. Unfortunately, I didn't find any free program to do the job - but you are encouraged to search one and to post a link as a reply if you find one. The otehr possiblity if to find a site with free, non-resticted fonts and to use one of these - the one that matches your idea.

A bitmap font, even a big one, is still a rather small bitmap. Moreover it is loaded only once. If you check my little TTT (see my GDS showcase) you'll see that I use an enormous bitmap fond with only the glyph I needed. Even if it is really big, I don't feel this 512x512x24bit bitmap (768kB!!) will be a heavy memory burner (it could be reduced to 256x256x8bit easily, which would make it a 65kB bitmap if memory were really a problem).

The fact is that it is faster to render from a bitmap font than from a truetype one, because you don't need to create a temporary texture, raster the font to this texture and send it to the GPU. Of course, you miss some nifty TT font features - kerning, support for other charsets, and so on. But it is easy, fast and very convenient.

Regards,
I made my own font in typography class before
I don't know to use them in pc's though only macs
----------------------------------------------------------feed a man a fish and you feed him everydayfeed a man a poisened fish and you never have to feed that man again
Hi thanks for the help. I don't get this why does the GPU render everything to a texture? and not justy like it is static? like word displays text realy fast and easy but why can a game not do the same?

And also there is a font editor called fontlab that is dear though [sad] but microsoft has additional font tools http://www.microsoft.com/typography/tools/tools.aspx
Yes i think i found a font tool, look in windows system32 folder and go to eudcedit.exe or go to start->run and type the name in. You will get a private character editor that can creat custom symbols and characters for font librarys [smile].

[Edited by - GameMasterXL on June 23, 2005 10:43:04 AM]
The main advantage of Truetype fonts is that they are scalable. Bitmap fonts look fine at thier native size but if you try to scale them they usually look terrible. Truetype fonts can look great at any size, although at small sizes it can be a bit tricky. The perf aspect is mostly a non-issue since you can render the realization of your choice (size, weight, etc) to a temporary bitmap once and at that point you've basically got a custom bitmap font.

eudcedit isn't really intended for creating fonts that will be distributed. It's for east-asian writing systems that can have arbitrary images as part of thier "character set". The scenario might be that you are Japanese and your family name is some random character that you or some ancestor literally pulled out of the air. You can then use eudcedit to draw the character and later use it in documents. These "end-user defined characters" are specific to your machine however and won't necessarily be visible on a different machine.

Quote:like word displays text realy fast and easy but why can a game not do the same
Games can do the same. However the base 3D libraries (DX, OpenGL) typically don't have support for it so you need to roll your own font engine. The 3D libraries probably don't want to get involved because it can be a huge undertaking to create drivers for all the varius font formats as well as handling all the complexities add up real fast if you want to be fully general - far-east languages with potentially infinite numbers of glyphs, middle-east languages where glyph shapes are context sensitive, multi-lingual strings, vertical writing systems, right-to-left and bi-directional writing systems, not to mention petty (to outsiders) political issues between countries that supposedly use the same writing systems but actually have differences, etc, etc.
-Mike
True type fonts using windows GDI are very slow (don’t believe me? Write your own textbox class). How word displays text so quickly is… well it doesn’t. Instead it is smart enough to know what parts of the text has changed and only write over that particular section. If you scroll in a word document what you are actually doing is just shifting a saved image of the document in the direction that you are scrolling, and then updating the now “invalidated” area. Thus Word gets good performance via only updating what actually needs to be updated.

Not saying true type fonts cannot be used in games, first off you may write your own true type renderer (Direct3D has this, however I cannot get good performance from it), or you could write the font to a bitmap at run time and use those bitmaps to quickly shoot the characters onto the screen. Or you could always take the windows application approach and only refresh the text when you need to.

Anyway, Hope that helps.

Quote:Original post by GameMasterXL
like word displays text realy fast and easy but why can a game not do the same?


Well... Word uses a lot of memory you know ;)

Moreover, Word do not work as you'll have to work in a game. Word directly writes the characters on screen, while you'll have to create an offsreen buffer, render the font to tis buffer, then use this buffer as a texture and render a quad using this texture. Finally, you'll have to desroy the off-screen buffer and the texture - because you won't reuse them. As you can understand, there are more work to do.

Regards,
Quote:True type fonts using windows GDI are very slow (don’t believe me? Write your own textbox class). How word displays text so quickly is… well it doesn’t
You do realize that Word uses GDI to display text? You can try it yourself - get one of the platform sdk debuggers (cdb or ntsd) set a breakpoint on gdi32!ExtTextOutW and you'll see Word calling it every time you type something. Word may be smarter about repainting than the text control is but that doesn't really say anything about what's below.

If you're targeting Windows there's no need to write your own Truetype renderer - there's one built in to the system. Just use GDI to render the text to a texture and you're done, you can even do anti-aliased text with a small amount of post-processing. If you want Word performance instead of notepad performance you're going to have do some intelligent caching but that's life in the big city.
-Mike
Is what i don't get though is why everything needs to be rendered to a texure? and not just outputed has pixels on the screen without all texture data.
Quote:Original post by Anon Mike
You do realize that Word uses GDI to display text?


I think what CyberFox meant is that while it does use GDI to actually draw text, it doesn't draw the whole screen every time you type a character - just the character you just typed (actually it probably has to draw a complete word or line, to account for combined characters and ligatures). Personally, I don't know if that's how it actually works or not, but I think that's what CyberFox was implying.

Quote:Original post by GameMasterXL
Is what i don't get though is why everything needs to be rendered to a texure? and not just outputed has pixels on the screen without all texture data.


Well, it is possible to get a direct pointer to the back buffer's memory. However, because of the heavily-piplined nature of 3D hardware, by first rendering the text to a texture, and giving that to the hardware, you don't end up stalling the pipeline.

This topic is closed to new replies.

Advertisement