Solved

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

Posted on 2006-06-25
7
1,107 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
  • 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
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 125 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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 7 - Fuzzy Fonts 11 80
1350 HP printer error - paper jam 8 36
gift wrap ribbon printing 2 51
Receipt Printer for web based app 3 86
How to solve seemingly unsolvable printer issues. Users sometimes run into printing issues where all the normal steps do not seem to work. Well the steps below can show users how to take one extra step beyond the normal steps needed to remove old…
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 …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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…

828 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