Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I print with a specific printer device font, not a truetype font?

Posted on 2006-06-25
7
Medium Priority
?
1,126 Views
Last Modified: 2013-12-03
My app (in Visual C#) prints using various fonts as follows:

                  Font font = new Font("Arial", 7);
                  e.Graphics.DrawString("Hello World", font, Brushes.Black, x, y);

But how do I print with a specific device font that is installed on the printer itself? The code above just picks a TrueType font installed on the computer.

0
Comment
Question by:groovyjon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 21

Expert Comment

by:wyliecoyoteuk
ID: 16980003
depends on the printer.
If it is a PCL printer, truetype fonts are often mapped to printer fonts. Otherwise, you would need to embed a PCL font command into the I/O stream.
Other print languages have different ways of doing things.

If you are using a GDI printer, the file is rendered within windows, so the font is renderd as an image by the GDI API, and "printer" fonts do not exist.
0
 

Author Comment

by:groovyjon
ID: 16980055
It's a thermal receipt printer (Star TSP100) and does have its own device fonts. One of them is called "control" and when certain characters in that font are printed, it performs certain actions (e.g. printing letter A in Control font triggers the attached cash drawer to open). I need to perform these actions hence the need to use its own fonts rather than the truetype fonts I've used up to now.
0
 
LVL 21

Expert Comment

by:wyliecoyoteuk
ID: 16986752
Ah, embedded command font. I have used some fax applications which use these.

Usually, you need to install the font into windows.
It may install with the printer driver, or it may be on the driver disk.
You may need to use square brackets [ ] or another symbol to embed it into the I/O stream.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 21

Expert Comment

by:wyliecoyoteuk
ID: 16986890
the programming manual does not mention a command font, it seems to use escape codes to control the printer:

http://www.starmicronics.com/printers/printers_pages/support/manuals/linemodepm.pdf

The escape character shown as "ESC" is a non printing character, and how you produce it depends on which editor you are using.(for example Vim uses ctrl+esc, if I remember correctly, but other editors use different combinations, or you can use an ASCII code)
0
 

Author Comment

by:groovyjon
ID: 16987380
Hmmm, I hadn't seen that manual, I was looking at a user's manual which kept referring to "control fonts". I'll have to have to try to get my head round all this as it's quite new to me - I'm not even sure what it means by "line mode". At the moment, I'm printing TrueType fonts which I guess just get sent to the printer as graphics so escape codes aren't going to be applicable in that context.
0
 
LVL 21

Accepted Solution

by:
wyliecoyoteuk earned 500 total points
ID: 16988360
The control fonts may well be new, and limited to that model, as there seems to be no up to date version of the manual.
Escape codes are often embedded in PCL or Esc/2p pages, the ESC symbol is interpreted by the printer as a prefix to a command.
0
 

Author Comment

by:groovyjon
ID: 16995519
I have it sorted now - the solution was to spool raw text including the escape sequences rather than using TrueType fonts. Thanks wyliecoyoteuk, I owe you one!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Printers have changed substantially in the last 30 or so years, not just in technical capabilities but in cost and usage as well.  Printers were originally used for interfacing with the operator, not necessarily for printing copy or pictures. In …
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question