In January 2002 twelve European currencies were replaced by one common currency, the Euro. Because of this, many programmers were facing the problem of updating their old DOS-based applications with support for the Euro character. The solution described in this document may be suitable for some of those programmers but definitely not for all.
First of all, it is a solution for printing the Euro character, not for displaying it on screen. Also, it will only work on the HP LaserJet 4 and newer HP laser printers and on LaserJet compatible printers from other manufacturers. It will not work on dot matrix or ink printers or on laser printers that do not support the PCL5 printer control language. It is also only designed for those who print in character mode using the built-in fixed pitch Courier font of the laser printer. In this document, all supported printers are referred to as LaserJet printers regardless of manufacturer.
The demo that accompanies the Euro macro file is written in Clipper, but the principles for using the Euro macros are in no way specific to any programming language. But, as mentioned above, they are specific to the targeted type of printer.
Download the Euro macro files here"Pre-loaded" means that in order to use a macro you have to either download the macro file into the printer before your application is started or use a function within your application to download it at the beginning of the document you want to print. In the case of the Euro macro, the macro file is only about 12 KB, so the download time is negligable.
Macros can contain anything that is printable. In addition to plain text, this includes lines and boxes drawn with PCL or HP-GL code as well as graphic images. The latter need to be converted to PCL code before they are downloaded. Of course, macros can (and do) also contain a variety of commands for controlling the printer's behaviour.
Macros can be either temporary or permanent. Temporary macros are automatically deleted from the printer's memory after execution. Permanent macros are not deleted until a specific delete command is sent to the printer or the printer is powered down. A printer reset does not delete permanent macros. The Euro macros are of the permanent type, so there is no need to download them more than once after the printer has been powered up.
Macros that contain graphics, as is the case with the Euro macros, must be downloaded as binary, that is, if the COPY command in DOS is used, the /B switch must be supplied. If you download the macros into the printer from inside your application, the printer port must first be set to RAW mode. Failure to do so will result in corruption of the graphic images.
Each overlay macro must have a macro number for identification. The macro number is coded into the character stream that the printer reads when the macro file is downloaded. The same number must be supplied by the calling code in order to execute the macro. Please note that the macro number must be a string of numerical characters and not a numerical value.
If a macro with the same number as one of the macros provided in this package is already downloaded into the printer it will be overwritten, which may interfere with printing of other documents. Conversely, if another macro with the same macro number as one of the Euro macros is downloaded into the printer after downloading the Euro macro file, printing of the Euro character will fail.
There are three different pitches: 10, 12 and 17 (or 16.67)
characters per inch.
There are two different bolding options: Bold and non-bold
There are two different italization options: Italic and non-italic
And finally, there is one version for portrait printing and one for
landscape printing for each combination of the three previous
attributes.
In all, this makes 3 x 2 x 2 x 2 = 24 different macros. Each macro has
its own macro number.
|
Base macro number 12800 Portrait, 10 CPI, Normal For variant attributes, add one or more of the following: Bold 1 Italic 2 12 CPI 4 17 CPI 8 Landscape 16
Do not add both 12 CPI and 17 CPI at the same time as the
combi- |
|
Complete macro list: Base B I 12 17 Ls Total Portrait, 10 CPI, Normal 12800 + 0 + 0 + 0 + 0 + 0 = 12800 Portrait, 10 CPI, Bold 12800 + 1 + 0 + 0 + 0 + 0 = 12801 Portrait, 10 CPI, Italic 12800 + 0 + 2 + 0 + 0 + 0 = 12802 Portrait, 10 CPI, BoldItalic 12800 + 1 + 2 + 0 + 0 + 0 = 12803 Portrait, 12 CPI, Normal 12800 + 0 + 0 + 4 + 0 + 0 = 12804 Portrait, 12 CPI, Bold 12800 + 1 + 0 + 4 + 0 + 0 = 12805 Portrait, 12 CPI, Italic 12800 + 0 + 2 + 4 + 0 + 0 = 12806 Portrait, 12 CPI, BoldItalic 12800 + 1 + 2 + 4 + 0 + 0 = 12807 Portrait, 17 CPI, Normal 12800 + 0 + 0 + 0 + 8 + 0 = 12808 Portrait, 17 CPI, Bold 12800 + 1 + 0 + 0 + 8 + 0 = 12809 Portrait, 17 CPI, Italic 12800 + 0 + 2 + 0 + 8 + 0 = 12810 Portrait, 17 CPI, BoldItalic 12800 + 1 + 2 + 0 + 8 + 0 = 12811 Landscape, 10 CPI, Normal 12800 + 0 + 0 + 0 + 0 + 16 = 12816 Landscape, 10 CPI, Bold 12800 + 1 + 0 + 0 + 0 + 16 = 12817 Landscape, 10 CPI, Italic 12800 + 0 + 2 + 0 + 0 + 16 = 12818 Landscape, 10 CPI, BoldItalic 12800 + 1 + 2 + 0 + 0 + 16 = 12819 Landscape, 12 CPI, Normal 12800 + 0 + 0 + 4 + 0 + 16 = 12820 Landscape, 12 CPI, Bold 12800 + 1 + 0 + 4 + 0 + 16 = 12821 Landscape, 12 CPI, Italic 12800 + 0 + 2 + 4 + 0 + 16 = 12822 Landscape, 12 CPI, BoldItalic 12800 + 1 + 2 + 4 + 0 + 16 = 12823 Landscape, 17 CPI, Normal 12800 + 0 + 0 + 0 + 8 + 16 = 12824 Landscape, 17 CPI, Bold 12800 + 1 + 0 + 0 + 8 + 16 = 12825 Landscape, 17 CPI, Italic 12800 + 0 + 2 + 0 + 8 + 16 = 12826 Landscape, 17 CPI, BoldItalic 12800 + 1 + 2 + 0 + 8 + 16 = 12827 |
|
Macro numbers 12812-12815 and 12828-12831 are reserved |
The macros in EURO.HP4 are all well behaved, which means that they push the cursor position when they start running and pop it back immediately before returning to the calling code. This also means that printing a Euro character does not advance the cursor. So as far as the surrounding text is concerned, the Euro character does not occupy any space on the printed page. Instead, it is necessary for the calling code to supply a space character after returning from the macro call. This also solves the problem with how the macros are to know exactly how many PCL units they should move the cursor if they were required to re-position it after printing the Euro character. With the implemention described above, the answer is that they do not need to care about that at all.
Since the Euro macros are designed for use with fixed pitch fonts, printing a space after returning from the macro call will align the remaining text on that line perfectly with the text on the rest of the page.
The Euro characters printed by the Euro macros are transparent, which means that any character (space or other character) that is printed in the same position on the page as the macro will show up as a "double exposure" with the two characters printed on top of each other.
The demo consists of the EURODEMO.PRG file and the EURO.CH include file. The include file lists the suggested #defines for building macro numbers for different purposes. It also has a section with #defines for PCL font and attribute selection. Those defines are used in EURODEMO.PRG for combining LaserJet font attribute variants in the surrounding text with the appropriate Euro macro. Feel free to use those defines or to change them to whatever fits the way you normally work (or to skip them entirely).
The demo prints four pages, two of them in portrait mode and two in landscape mode. On each page there are 12 lines of numerical characters with an embedded Euro character in the middle of each line. The 12 lines correspond to the 12 attribute variants in the table above. The first two pages are printed using specific #defines for each font attribute combination (in portrait and landscape mode, respectively) for the text, and the last two pages are printed using "component" #defines which are added together to create the desired font attributes. Please take a look at the include file for details on how to use the #defines. And if you want to use the component #defines for font selection, be sure to read the comments about required and optional components and the order of components, also available in the include file.
The EURODEMO.PRG file also contains a function called Euro(). It adds the different attribute #defines for the Euro character together and returns a string with the complete command for calling the appropriate Euro macro. It also adds the space character mentioned above in the "Spacing and cursor positioning" section, so the cursor position is advanced to the character position after the Euro character.
Don't forget to download the EURO.HP4 file into the printer before running the demo! Again assuming that the printer is connected to LPT1, type COPY EURO.HP4 LPT1: /B
HP LaserJet 4 family (not tested on 4L)
HP LaserJet 5 family (including 5L)
HP LaserJET 6MP
HP LaserJet 2100
HP LaserJet 40xx family
HP LaserJet 41xx family
HP Color LaserJet 4500 (B&W only)
Ricoh Aficio 350
Kyocera Ecosys FS-3750
Kyocera mita Ecosys FS-1800
Lexmark Optra SC 1275
Some non-HP printers may require special settings before they accept PCL macros. See the technical manual for your printer for info. And the macros will of course only work in PCL mode on those printers that have other emulations in addition to PCL. Some printers may lose the downloaded macros when certain kinds of other jobs ar being printed if there is not enough physical memory present in the printer. This is true for the HP LaserJet 4 family, for example. And in some cases, macros may be lost when the printer enters power saving mode. Again, see the printer manual for suggestions if the macros disappear for no obvious reason.
It is up to you to determine whether the Euro macros are suitable for your and your clients' needs and for the printer models you intend to use. It is also your responsibility to make sure that they do not interfere with anything else that is being printed on the printers into which you download the macro file (using the same macro numbers).
The Euro macros (EURO.HP4), the demo application (EURODEMO.PRG), the include file (EURO.CH) and this document are supplied "as is". The author assumes no responsibility for errors, omissions or malfunctions. No liability is assumed for damages resulting from the use of the aforementioned files or any information contained therein. By using any of those files or any part thereof you agree to these terms.
| EURO.ZIP | Download the Euro Macro files |
| In case you want to talk to me about the Euro Macros
(no general Clipper support questions please) |
|
| Back | Go back to the Engwall InfoTech Clipper Pages main page |
This document was last revised on 2007-10-01