Anit-Aliased fonts on Surface.Canvas

Started by
2 comments, last by Hari 23 years, 1 month ago
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
[email=alien@xpoint.at]Harald Sefzig[/email]Developerwww.alien.at
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 ]
[ Michael Wilson | turbo sys-op | turbo.gamedev.net ]
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
[email=alien@xpoint.at]Harald Sefzig[/email]Developerwww.alien.at
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
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers

This topic is closed to new replies.

Advertisement