Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change font with Printer.Font.Name 1

Status
Not open for further replies.

GPerk

Programmer
Joined
Jul 6, 2002
Messages
161
Location
US
I am using:
Printer.Font.Name = "Courier"
Printer.Font.Size = 8
Printer.Print txtData.Text
Printer.EndDoc

Because txtData contains columns of text and/or numbers, I do not want to use a variable width font.
Both the Form and Textbox fonts are set to Courier.
But the code above does not actually change the font to Courier on the printer.

I know this is an old problem, but I can't find the solution on Tek-Tips or anywhere on the net.
I have seen that some programmers use Doevents after setting the new font, or use Printer.Print "" before printing the data.
Neither of these work for me.

In another program I am using Printer.Font.Name = "QuickType Mono"
and that works. But it doesn't work in this program.

Can someone explain this?


 
Try them in the reverse order
Code:
Printer.Font.Size = 8.5
Printer.Font.Name = "Courier New"
If you set a font size that is not supported by your selected font then Windows won't change the font.

Also, use "Courier New" rather than "Courier".

"Courier New" is a True Type font but "Courier" is not.
 
Thanks, Golom!
I made both those changes and now it works properly.

I had avoided Courier New because I thought that TrueType meant that the font characters were of different width. And I wanted fixed width characters.
But now I see that Wikipedia has this to say about TrueType:

"The primary strength of TrueType was originally
that it offered font developers a high degree of
control over precisely how their fonts are displayed,
right down to particular pixels, at various font
heights. (With widely varying rendering technologies
in use today, pixel-level control is no longer certain.)"

I see that VB6 IDE Font Change displays 'TT' for most fonts, a blank for Courier, and an 'O' for Courier New.
What does that 'O' stand for???
 
After further reading in Wikipedia, I see reference to "OpenType".
So, the 'O' displayed in the Font Change in the IDE probably indicates "OpenType".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top