Fonts

Started by
8 comments, last by B4 23 years, 7 months ago
I was wondering how I can use a custom font I downloaded in my DirectX application. I looked at the CreateFont() function but I do not understand how I can load a non-standard font. If there is an example or tutorial somewhere, I would greatly appreciate a link. Thanks in advance. -B4
Advertisement
To use GDI functions on a DirectDraw surface, you must call GetDC on the surface when you want to draw text on the surface. This locks the entire surface until you release the DC. This is very costly time-wise.

To avoid making the call to GetDC, and henceforth get a major speed improvement, what I do is make a bitmap of all the characters I want from the font using a paint program such as PaintShop Pro. Align these characters into a grid. Load this bitmap into an offscreen surface and then use your own little routine to blit the characters onto the destination surface. Basically your own Textout routine, but using a bitmap image of the font characters instead of the actual TrueType font and the (slow) GDI text routines.



Steve 'Sly' Williams
Tools Developer
Krome Studios
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
If you go over to Mr-Gamemaker.com they have a tutorial on how to make a bitmap from a truetype font and then how to use it in your own games.

Also I have seen an aplication that can take your tru-type fonts and convert them into a anti-aliased font for use within DX, you can find it here : http://maginusorb.dhs.org/gamefont/

It''s pretty good, download the example first to see if you want to use it.
When I find my code in tons of trouble,Friends and colleages come to me,Speaking words of wisdom:"Write in C."My Web Site
Thank you very much.
quote:Original post by Steven

Also I have seen an aplication that can take your tru-type fonts and convert them into a anti-aliased font for use within DX, you can find it here : http://maginusorb.dhs.org/gamefont/



GameFont rules! I am using it in my game, too. It is the best fontengine, i know.

- - - - - - - - - - - - - -
Andreas Mähler
Wolf359 Interactive
How do you get GameFont ? I went to that link but you have to be a member or something to get it ? anyone know where else I could get a copy?



Sincerely,
Jonathan
A.K.A. -- Fourth Horseman
Sincerely,JonathanA.K.A. -- Fourth Horseman
making bmp fonts is basically a great idea... ONLY if the language u''re talking about is english or any european languages... when it comes down to languages like japanese and chinese, bmp fonts is totally infeasible (how large would it be for 40,000 character? 20mb?? ha.. ^^) so anyone has any idea to get around this?
(AP Man) One word: dynamic generation via basic building blocks.
Ok more like one phrase. Actually many words in asian languages are make up of smaller bits, which are in turn made up of strokes. Record the strokes, and then the smaller bits, for each character. Dada! Definite size improvement (tho'' I don''t know about speed )


------------------------------
What should I put here? You tell me.
quote:Original post by c++freak

(AP Man) One word: dynamic generation via basic building blocks.
Ok more like one phrase. Actually many words in asian languages are make up of smaller bits, which are in turn made up of strokes. Record the strokes, and then the smaller bits, for each character. Dada! Definite size improvement (tho'' I don''t know about speed )


------------------------------
What should I put here? You tell me.


^^ u''re dead right about the "block-building" part of asian language...but it probably won''t be a good idea (nor close to be) when needs to make up a table of formation for the whole 40,000 characters... ^^ as i understood..a lot of asian langauge gaems simply make bitmaps for every single dialog appears in the gmaes (yes.. this is probably a rpg game i''m talking about).. very inefficient... but guess that''s how life is.. ^^ the history might need to be re-written if the first computer was invented by an asian.. ^^ ha.. ^^


quote:
.. very inefficient... but guess that''s how life is..

True. But you know, Internet Explorer can do asian languages, and it''s only what? 6 mb for each asian language? So there must be a way of cutting down on the characters.



------------------------------
BCB DX Library - RAD C++ Game development for BCB

This topic is closed to new replies.

Advertisement