Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 VB6 Font usage
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

maxhamner
Squire

USA
26 Posts

Posted - Nov 11 2004 :  08:20:27 AM  Show Profile  Reply with Quote
Here is the font I use to load fonts for my apps without installing them. Not very special, but handy. I use this instead of making bitmaps of fonts so I can draw text in any size/color in my programs, and even do 'drop shadows' by drawing the font twice (black with offset, normal without offset), and other effects.

The nice part is that DX7 can use them once they (fonts) are added. The calcwidth, calcheight functions make it easy to mange where you will draw the text to center it, handle wrapping etc.

If you have a 'box" where you draw messages you can use "calctextwidth" on each word, and if it doesn't go outside the box use the Directdraw function "drawtext" with the last parameter set to true to append the last draw... makes for a super easy word wrap that works in ANY font/size.

Download Attachment: Font.bas
13.31 KB

--
max
There are 10 kinds of people in the world, those that understand binary and those that don't.

Eric Coleman
Gladiator

USA
811 Posts

Posted - Nov 11 2004 :  08:32:11 AM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
That's an interesting method you use for calculating the text's width and height.

Go to Top of Page

CoBreaker
Neophyte

Portugal
1 Posts

Posted - Nov 12 2004 :  07:48:41 AM  Show Profile  Reply with Quote
this is very interesting, but! can u help? lol i mean:

• what u mean by fontname? its the file name or font name?
• does i need to add the extension? (TTF)
• how can that be drawn on the form?? i mean i can print it but the font is the default only the size changes when use the size of the fontmod.calctextwidth...

were code meets art?

Edited by - CoBreaker on Nov 12 2004 07:50:18 AM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.1 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.