Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > How to smoothen fonts ?


Reply
 
Thread Tools Display Modes
  #1  
Old 07-27-2003, 09:49 PM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default How to smoothen fonts ?


I am having some problems when I print out using printer object.
I have added an attachment to below.

The fonts are not smooth. It appears very jaggered at the edges. The letter 'A' looks horrible. Is there anyway to smoothen the edges of the fonts?
Attached Images
File Type: jpg sample3.jpg (5.9 KB, 30 views)
Reply With Quote
  #2  
Old 07-27-2003, 11:16 PM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default

To elaborate further, I tried to input text on label controls and printed it out. On screen it appears jaggered but when it is printed out, the fonts are very smooth.
The method I used is to make a screencapture of the fonts before I sent to print. Maybe this is the reason the fonts is so jaggered? Anyway for me to prevent the fonts from looking this way before I sent it for print?
Reply With Quote
  #3  
Old 07-27-2003, 11:46 PM
diamond_panther's Avatar
diamond_panther diamond_panther is offline
Junior Contributor
 
Join Date: Oct 2002
Location: The Moon - Yes! Its true
Posts: 222
Default

pixels, the problem is pixels, font sizes (11,12,14,16,ect) are values that tell the computer how may pixles to fit to the display grid (note only with SOME fonts others use these numbers to grab a line from their definitions)

if u use a number NOT on the normal list then the computer has to impravise (or if you capture form screen it is a bit map and wont be nice and clean - try to resize a bmp file, see what i mean?)


to fix this make SURE u dont use print screen (try form.print) or else try usiong standard print keywords to print control captions...

does this help?
__________________
"...You would know zat another word for an iconographer would be 'photographer'? From the old word photus in Latation, vhich means-'
'To prance around like a pillock ordering everyone about as if you owned the place?..."
Reply With Quote
  #4  
Old 07-28-2003, 12:32 AM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default

I am not using printscreen. This is what I am using:

Set rPicture = hDCToPicture(hDC, lpRect.Left + 30, lpRect.Top + 100, 730, 145)

Printer.PaintPicture rPicture, Printer.CurrentX, Printer.CurrentY

Since the pixels is giving problem, what should I do?
Resizing the bmp is out of the question, since I need it to be of a fixed size.


Quote:
Originally Posted by diamond_panther
pixels, the problem is pixels, font sizes (11,12,14,16,ect) are values that tell the computer how may pixles to fit to the display grid (note only with SOME fonts others use these numbers to grab a line from their definitions)

if u use a number NOT on the normal list then the computer has to impravise (or if you capture form screen it is a bit map and wont be nice and clean - try to resize a bmp file, see what i mean?)


to fix this make SURE u dont use print screen (try form.print) or else try usiong standard print keywords to print control captions...

does this help?

Reply With Quote
  #5  
Old 07-28-2003, 01:25 AM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default

The strangest part is that when I tried using printform, the fonts are very smooth! (but I cannot use printform since it cannot print A4 size)
Reply With Quote
  #6  
Old 07-28-2003, 02:37 AM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default

Please advice......
Reply With Quote
  #7  
Old 07-28-2003, 03:56 AM
passel's Avatar
passel passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
Default

Quote:
Originally Posted by pylc
Please advice......



I don't know if it will work for your application, but the best way to get
exactly what you want on a printer is to print/write/draw directly to
the printer object.

i.e.

printer.font = "whatever you font is...."
printer.fontsize = 24
printer.line (0,0)-(24000,56000),vbRed,bf
printer.CurrentX = 5000
printer.CurrentY = 1000
printer.Print "USA"
....etc
printer.Enddoc

You can change the printer.ScaleWidth and ScaleHeight to make
addressing the paper in X,Y more convienient.
Reply With Quote
  #8  
Old 07-28-2003, 06:38 PM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default

I can try doing this....but I need to print the form layout as well. These sticker designs are dynamic. Based on the database read in, the wordings and color of the stickers will change correspondingly. I can print the letters, but what about the design? I have some label controls which I need to draw in as well.

I attached a sample to illustrate the output I require. Basically the only problem now is that the wordings are very rough. Please advice! Thanks!

Quote:
Originally Posted by passel
Quote:
Originally Posted by pylc
Please advice......



I don't know if it will work for your application, but the best way to get
exactly what you want on a printer is to print/write/draw directly to
the printer object.

i.e.

printer.font = "whatever you font is...."
printer.fontsize = 24
printer.line (0,0)-(24000,56000),vbRed,bf
printer.CurrentX = 5000
printer.CurrentY = 1000
printer.Print "USA"
....etc
printer.Enddoc

You can change the printer.ScaleWidth and ScaleHeight to make
addressing the paper in X,Y more convienient.

Attached Images
File Type: jpg sample4.jpg (11.4 KB, 12 views)
Reply With Quote
  #9  
Old 07-28-2003, 08:47 PM
blindwig's Avatar
blindwig blindwig is offline
Ultimate Contributor

* Expert *
 
Join Date: Jun 2003
Location: New York, NY
Posts: 1,929
Default

Quote:
Originally Posted by pylc
I am not using printscreen. This is what I am using:

Set rPicture = hDCToPicture(hDC, lpRect.Left + 30, lpRect.Top + 100, 730, 145)

Printer.PaintPicture rPicture, Printer.CurrentX, Printer.CurrentY

Since the pixels is giving problem, what should I do?
Resizing the bmp is out of the question, since I need it to be of a fixed size.


Technically, you are using print screen - you're taking a bitmap from display memory and sending it to the printer. The jaggedness comes from a difference of display resolutions - your screen shows you 96 DPI, and your printer is probably 300 or 600 (or more) DPI, so the jaggedness shows up 3x or 6x (or more) on your printer than on your screen.

I haven't worked with printing much myself, but I think the best way to do it is to use a printer object, as passel suggests.
Reply With Quote
  #10  
Old 07-28-2003, 09:18 PM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default

I am willing to try this approach. But how do I print the label controls in my background?

Quote:
Originally Posted by blindwig
Quote:
Originally Posted by pylc
I am not using printscreen. This is what I am using:

Set rPicture = hDCToPicture(hDC, lpRect.Left + 30, lpRect.Top + 100, 730, 145)

Printer.PaintPicture rPicture, Printer.CurrentX, Printer.CurrentY

Since the pixels is giving problem, what should I do?
Resizing the bmp is out of the question, since I need it to be of a fixed size.


Technically, you are using print screen - you're taking a bitmap from display memory and sending it to the printer. The jaggedness comes from a difference of display resolutions - your screen shows you 96 DPI, and your printer is probably 300 or 600 (or more) DPI, so the jaggedness shows up 3x or 6x (or more) on your printer than on your screen.

I haven't worked with printing much myself, but I think the best way to do it is to use a printer object, as passel suggests.

Reply With Quote
  #11  
Old 07-29-2003, 09:39 PM
passel's Avatar
passel passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
Default

Quote:
Originally Posted by pylc
I am willing to try this approach. But how do I print the label controls in my background?

Quote:
Originally Posted by blindwig
Quote:
Originally Posted by pylc
I am not using printscreen. This is what I am using:

Set rPicture = hDCToPicture(hDC, lpRect.Left + 30, lpRect.Top + 100, 730, 145)

Printer.PaintPicture rPicture, Printer.CurrentX, Printer.CurrentY

Since the pixels is giving problem, what should I do?
Resizing the bmp is out of the question, since I need it to be of a fixed size.


Technically, you are using print screen - you're taking a bitmap from display memory and sending it to the printer. The jaggedness comes from a difference of display resolutions - your screen shows you 96 DPI, and your printer is probably 300 or 600 (or more) DPI, so the jaggedness shows up 3x or 6x (or more) on your printer than on your screen.

I haven't worked with printing much myself, but I think the best way to do it is to use a printer object, as passel suggests.




Not to leave you hanging, but when it comes to an alternative to printform (in order to get controls, buttons, labels,....) I haven't found
a real solution yet. I tried several things sometime back, but could
never get a large, smooth image. For my part, is was an investigation of
curiosity, so I didn't have to solve it, and never did.
' That's why I had the caveat "I don't know if it will work for your
application...", in my first post. Some others are drawing to picture
boxes, or printing on the form, and for those cases, going straight to
the printer, instead of using printform makes since. Since your picture,
only showed Text on Colored backgrounds, I thought that if there wasn't more to it than that, you could just print and draw to the printer.

Sorry I couldn't be helpful.
Reply With Quote
  #12  
Old 07-29-2003, 09:47 PM
passel's Avatar
passel passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
Default

Quote:
Originally Posted by passel
Quote:
Originally Posted by pylc
I am willing to try this approach. But how do I print the label controls in my background?



Not to leave you hanging, but when it comes to an alternative to printform (in order to get controls, buttons, labels,....) I haven't found
a real solution yet. I tried several things sometime back, but could
never get a large, smooth image. For my part, is was an investigation of
curiosity, so I didn't have to solve it, and never did.
' That's why I had the caveat "I don't know if it will work for your
application...", in my first post. Some others are drawing to picture
boxes, or printing on the form, and for those cases, going straight to
the printer, instead of using printform makes since. Since your picture,
only showed Text on Colored backgrounds, I thought that if there wasn't more to it than that, you could just print and draw to the printer.

Sorry I couldn't be helpful.



There is a link to an commercial .ocx that claims to address this issue.
They have a free trial. You can check it out and see if it's worth it for
your situation.

http://www.componentgarden.com/vp_printform.htm
Reply With Quote
  #13  
Old 07-29-2003, 10:01 PM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default

Sigh....Never expect its so hard to do a simple printing. Basically, my boss wants to print A4 size and want smooth fonts. Fonts must be 90 degrees rotated as well.

Printform cannot be used for the A4 since I need to duplicate a template image on the entire A4. Print object dont have the anti liasing capability althought it can print A4. sigh......

I thought I got the whole thing worked out, never thought I would be stuck with the anti liasing of the fonts. Althought printform seems to support anti liasing, it does not have the flexibility to print a specific area. Passel, thanks anyway.
Reply With Quote
  #14  
Old 07-29-2003, 10:03 PM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default

I have tried the program you have indicated in the link before. It can do A4 printing, but the quality is very lousy. Does not address the issue of anti liasing.
Reply With Quote
  #15  
Old 07-29-2003, 10:36 PM
loquin's Avatar
loquin loquin is offline
Google Hound

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Arizona, USA
Posts: 12,378
Default

What are the specific controls you are trying to print?
__________________
Lou
"I have my standards. They may be low, but I have them!" ~ Bette Middler
"It's a book about a Spanish guy called Manual. You should read it." ~ Dilbert
"To understand recursion, you must first understand recursion." ~ unknown
Reply With Quote
  #16  
Old 07-29-2003, 11:32 PM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default

1 Frame with labels and picturebox controls in it. The labels display letters while picturebox controls display 90 degress rotated letters.
All these have been done as shown in the attachment in the 1st post. The only problem is the printing is not smooth...

I convert the picture into image so that I can print out. This is a segment of the code I used:

'picturebox control is in the frame
rpicture cuts out the entire frame for print
Set frmMain.Picture12.Picture = frmMain.Picture12.Image

'cut out the viewport required for printing
Set rPicture = hDCToPicture(hDC, lpRect.Left + 30, lpRect.Top + 100, 730, 145)

Printer.PaintPicture rPicture, Printer.CurrentX, Printer.CurrentY

After that, I got all the jaggered letterings....

However when I used printform, the letterings for the lables are very smooth! Only the letterings for the picturebox controls are rough. Maybe because they are images?



Quote:
Originally Posted by loquin
What are the specific controls you are trying to print?

Reply With Quote
  #17  
Old 07-30-2003, 06:39 PM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default Problem! still awaiting your expertise!

Hi all, I am still stuck with this problem. How do I resolve it?


Quote:
Originally Posted by pylc
1 Frame with labels and picturebox controls in it. The labels display letters while picturebox controls display 90 degress rotated letters.
All these have been done as shown in the attachment in the 1st post. The only problem is the printing is not smooth...

I convert the picture into image so that I can print out. This is a segment of the code I used:

'picturebox control is in the frame
rpicture cuts out the entire frame for print
Set frmMain.Picture12.Picture = frmMain.Picture12.Image

'cut out the viewport required for printing
Set rPicture = hDCToPicture(hDC, lpRect.Left + 30, lpRect.Top + 100, 730, 145)

Printer.PaintPicture rPicture, Printer.CurrentX, Printer.CurrentY

After that, I got all the jaggered letterings....

However when I used printform, the letterings for the lables are very smooth! Only the letterings for the picturebox controls are rough. Maybe because they are images?



Quote:
Originally Posted by loquin
What are the specific controls you are trying to print?


Reply With Quote
  #18  
Old 07-30-2003, 06:54 PM
passel's Avatar
passel passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 7,714
Default

Quote:
Originally Posted by pylc
Hi all, I am still stuck with this problem. How do I resolve it?


Quote:
Originally Posted by pylc
1 Frame with labels and picturebox controls in it. The labels display letters while picturebox controls display 90 degress rotated letters.
All these have been done as shown in the attachment in the 1st post. The only problem is the printing is not smooth...

I convert the picture into image so that I can print out. This is a segment of the code I used:

'picturebox control is in the frame
rpicture cuts out the entire frame for print
Set frmMain.Picture12.Picture = frmMain.Picture12.Image

'cut out the viewport required for printing
Set rPicture = hDCToPicture(hDC, lpRect.Left + 30, lpRect.Top + 100, 730, 145)

Printer.PaintPicture rPicture, Printer.CurrentX, Printer.CurrentY

After that, I got all the jaggered letterings....

However when I used printform, the letterings for the lables are very smooth! Only the letterings for the picturebox controls are rough. Maybe because they are images?



Quote:
Originally Posted by loquin
What are the specific controls you are trying to print?






Can you zip up the font file and a form with some code in it that displays
what you are trying to print. I wouldn't mine playing with it, if I get the
time. Since you can print and draw directly to the printer with high
quality, it might be easy enough to design with that capablity in mind,
and emulate the form, not actually copy the form, for print out.
' It may be just a matter of thinking of a different paradigm, rather than
focusing on reproducing the form.
Reply With Quote
  #19  
Old 08-01-2003, 02:54 AM
pylc pylc is offline
Regular
 
Join Date: May 2003
Posts: 92
Default Problem resolved using patch!

Hi Passel. I am unable to smoothen the fonts using any anti-aliasing method. However I did bypass the problem by drawing all the controls from scratch using code ONLY. Then I do the printing using API. Right now I am able to get very smooth printout ! So I guess I wont need to bother you on this issue
Thanks all for trying your best to help!


Quote:
Originally Posted by passel
Quote:
Originally Posted by pylc
Hi all, I am still stuck with this problem. How do I resolve it?


Quote:
Originally Posted by pylc
1 Frame with labels and picturebox controls in it. The labels display letters while picturebox controls display 90 degress rotated letters.
All these have been done as shown in the attachment in the 1st post. The only problem is the printing is not smooth...

I convert the picture into image so that I can print out. This is a segment of the code I used:

'picturebox control is in the frame
rpicture cuts out the entire frame for print
Set frmMain.Picture12.Picture = frmMain.Picture12.Image

'cut out the viewport required for printing
Set rPicture = hDCToPicture(hDC, lpRect.Left + 30, lpRect.Top + 100, 730, 145)

Printer.PaintPicture rPicture, Printer.CurrentX, Printer.CurrentY

After that, I got all the jaggered letterings....

However when I used printform, the letterings for the lables are very smooth! Only the letterings for the picturebox controls are rough. Maybe because they are images?



Quote:
Originally Posted by loquin
What are the specific controls you are trying to print?






Can you zip up the font file and a form with some code in it that displays
what you are trying to print. I wouldn't mine playing with it, if I get the
time. Since you can print and draw directly to the printer with high
quality, it might be easy enough to design with that capablity in mind,
and emulate the form, not actually copy the form, for print out.
' It may be just a matter of thinking of a different paradigm, rather than
focusing on reproducing the form.

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing Fonts From An Application berridgeab API 3 07-12-2003 06:59 AM
Fonts, Fonts, and Fonts Xilica2k2 General 2 08-07-2002 10:47 AM
Twips, Pixels, and Large Fonts bmw Interface and Graphics 9 08-06-2002 11:03 AM
small fonts to large fonts tina_v1 General 10 01-17-2002 05:35 AM
Difficult item: switching fonts... Spades General 7 11-01-2001 12:28 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->