Jump to content
  • Advertisement

Archived

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

Hari

Anit-Aliased fonts on Surface.Canvas

This topic is 6483 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

Hi to all... Does anyone know how to write a text antialised to a Surface ? I use following lines to do this on a simple canvas object: var LogFont: TLogFont; begin with DXDraw.Surface do begin GetObject(Canvas.Font.Handle,SizeOf(LogFont),AddrLogFont)); with LogFont do begin lfEscapement := 0; lfOrientation := 0; lfQuality := ANTIALIASED_QUALITY; lfOutPrecision := Out_TT_Only_Precis; end; Font.Handle := CreateFontIndirect(LogFont); TextOut(10,10,''Hello World''); Release; end; end; Or is it better to use images ? Think to write the text on the canvas is faster and ressource friendlier. Any ideas are wellcome... Thanks, Harald
Harald Sefzig Developer www.alien.at

Share this post


Link to post
Share on other sites
Advertisement
It''s probably more tradtional to use a BitMap font routine to write text for video games. You sacrifice Antiailising, but you get multi-colored, fast fonts.

The past few moths, turbo has has a host of bitmap font demos. Sly has just posted a nice code lib on the main page...



[ Michael Wilson | turbo sys-op | turbo.gamedev.net ]

Share this post


Link to post
Share on other sites
Sure, i am also using bitmaps for fonts but you are
more independent when using the canvas.
(other colors, angle, styles or so on...)

And because it is not antialiased it does not
look as good as i will have it










Harald Sefzig
Developer
www.alien.at

Share this post


Link to post
Share on other sites
Traditional GDI text drawing functions are a lot slower than using bitmap fonts. The reason for this is that to use GDI functions, you must get a device context for the surface and this involves locking the entire surface. Obtaining a surface lock is a very costly procedure in terms of time. Using bitmap fonts allows the hardware to blit directly to the surface without requiring any type of lock. Also, the GDI text drawing routines are very generic. Generic in this case means slower than a bitmap text routine written specifically for your software.

Steve ''Sly'' Williams  Code Monkey  Krome Studios

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!