Jump to content
  • Advertisement

Archived

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

B4

Fonts

This topic is 6528 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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?

Share this post


Link to post
Share on other sites
(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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.. ^^


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!