Skip to main content
gamedev.net
🔒 Locked

Fonts

Started by B4 Aug 27, 2000 at 10:31 PM 8 replies 400+ views
Original Post
B4
B4
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
Sly
Sly
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
Steven
Steven
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
B4
B4
Thank you very much.
Melo
Melo
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
Fourth Horseman
Fourth Horseman
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
risingdragon3
risingdragon3
(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.
risingdragon3
risingdragon3
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.