Soft HP LaserJet Printer Fonts on the RS/6000

Soft HP LaserJet Printer Fonts on the RS/6000


Referential Integrity & the Bridge Processing Code Index Level Spreadsheet Connective
Syntax
Category Article
Type Article
Description Downloading HP Laserjet fonts.

Contributed by Sean Tehrani
(Originally ran in PickWorld Magazine under the title: "Using Soft HP Laserjet Printer Fonts on the IBM RS/6000 Computer").

NOTE: The following code has been tested thoroughly, but is not guaranteed to perform as described, and may result in data corruption and loss.

This article describes the steps required to import and use soft fonts with a Hewlett Packard compatible laser printer on the RS/6000 computer running D3. Soft fonts are files which contain specifications for generating printer fonts. These files can be purchased from a variety of vendors, and they MUST be bitmapped fonts. In this document we assume the soft fonts are available on 3 1/2" DOS format diskettes.

Here is the procedure:

1)  Login as 'root' in AIX.   

2)  Make sure the following files are in the '/bin' directory in AIX: 'dosdir', 'dosread', 'cc'.

 If 'dosdir' or 'dosread' are not available then load the AIX   Optional Program Product 'bosext2.dosutil.obj'. If 'cc' is not available, load the AIX Optional Program Product 'xlccmp.obj'. Also, if the '/usr/include' directory doesn't contain the include files mentioned on lines 3-6 of the conv.c program below, then install the 'bosadt.lib.obj' Optional Program Product.

3)  In AIX type: # cd / <Return> # mkdir fonts <Return> # cd fonts <Return>

4)  Enter the following program using the vi editor:

 Type : vi conv.c <Return>  

001 /* CONVERT AN ASCII FILE TO ITS
002    ASCII-HEX REPRESENTATION */
003
004 #include <string.h>
005 #include <stdio.h>
006 #include <sys/types.h>
007 #include <sys/stat.h>
008 int main(int argc, char **argv)
009 {
010   /* DECLARE VARIABLES */
011   struct stat buf;
012   unsigned char ch, hexfile[128], *np;
013   FILE *fp1;
014   FILE *fp2;
015
016   unsigned long i     = 0;
017   /* THIS PROGRAM NEEDS A FILENAME
018      ON THE COMMAND LINE */
019   if (argc != 2)
020     {
021       printf("\nUsage: conv filename\n");
022       return(1);
023     }
024   /* GET INFORMATION ON THE FILE,
025      SUCH AS ITS LENGTH */
026   if(stat(argv[1], &buf) != 0)
027     {
028       printf("Problem getting info on file: %s \n", argv[1]);
029       return(1);
030     }
031   /* OPEN THE FILE FOR READING */
032   if ((fp1 = fopen(argv[1], "rb")) == NULL)
033     {
034       printf("Can't open file: %s\n", argv[1]);
035       return(1);
036     }
037
038   printf("Reading %ld bytes from file : %s\n", buf.stsize, argv[1]);
039
040   /* ADD EXTENSION ".hex" TO THE FILE */
041   if ((np = strrchr(argv[1], '.')) != NULL)
042     *np = '\0';
043   strcpy(hexfile, argv[1]);
044   strcat(hexfile, ".hex");
045
046   printf("Writing %ld bytes to file : %s\n", buf.stsize*2, hexfile);
047
048   /* OPEN THE OUTPUT FILE FOR WRITING */
049   if ((fp2 = fopen(hexfile, "wb")) == NULL)
050     {             
051       printf("Error creating hex file.");
052       fclose(fp1);
053       return(1);
054     }
055
056   /* CONVERT THE ASCII CHARACTERS TO ASCII-HEX */
057   for(i=0; i<buf.stsize; ++i)
058     {
059       ch = fgetc(fp1);
060       fprintf(fp2, "%02X", ch);
061     }
062
063   fclose(fp1);
064   fclose(fp2);
065   return(0);
066 }

5)  Now compile this file by typing:  

 cc conv.c -o conv <Return>

 Copy the executable file to the '/bin' directory:

 cp conv /bin/conv <Return>

6)  Insert the soft font diskette into the floppy drive and type (NOTICE THE PIPE CHARACTER '|') :

 dosdir -l | pg <Return>

 This will display the filenames on the DOS diskette. Select one of the files. (eg. MYFONT.USP)

7)  Import the selected font file by typing:

 dosread MYFONT.USP /fonts/MYFONT.USP <Return>

 NOTE: Instead of 'MYFONT.USP', use a filename which was   displayed in step 6.

8)  Now that the soft font file is in the 'fonts' AIX directory, we must convert it to a format which Pick can read. Type:

 conv MYFONT.USP <Return>

 This will convert the font file 'MYFONT.USP' to 'MYFONT.HEX' which is in ASCII-HEX format.

9)  Repeat steps 6 through 8 until all the soft font files have been copied to the '/fonts' directory and converted.

10)  Once the font files are converted to ASCII-HEX, start Pick, log to the 'dm' account and issue the following commands:

 import fonts,descr MYFONT.USP <Return>

 At the 'from:' prompt, type: /fonts/MYFONT.HEX <Return>

 NOTE: 'fonts,descr' is the Pick file where the fonts reside. 'MYFONT.USP' is the item to import. 'MYFONT.HEX' is the name of the AIX converted font file. Perform the above step for all fonts to be used with Pick; substituting 'MYFONT.USP' and 'MYFONT.HEX' with the appropriate font file names.

11)  Once the fonts are imported into the file 'fonts,descr', type the following: :

 select fonts,descr <Return>
 pitch-table fonts,descr <Return>
 select fonts,pitch <Return>
 pitch-compile fonts,pitch <Return>

12)  Now modify the file 'devices,hp-lzrii'. Type:

 ed devices hp-lzrii <Return>

 Change line 51 to the following:

 F,lx,X1B,C&,Ca,C+,A,CH,< -125 hmi

13)  Type: : assignfq X,hp-lzrii (c <Return>

 NOTE: 'X' is the number of the printer's form queue. (eg. assignfq 5,hp- lzrii)

14)  Now download the fonts. Type:

 select fonts,descr <Return>
 download fonts,descr (p0t <Return>

 All of the fonts in the 'fonts,descr' file will be downloaded starting with font id number 0 and a test print will be generated.

15)  To print using these fonts see, "font (Output Processor") and "@ function".

16)  From now on, perform the following steps in order to use fonts in Pick:

START THE PRINTER:

a)  Assign the form queue. (eg. assignfq 0,hp-lzrii)  
b)  Start the laser printer. (eg. startptr 0,0,1,s5)
c)  Select the form queue. (eg. sp-assign 0)

SELECT THE FONTS AND DOWNLOAD THEM:  

d)  Select the fonts to download. (eg. select fonts,descr font1.usp font2.usp font3.usp OR select fonts,descr)
e)  Download the font (eg. download fonts,descr (p0t) )
f)  Use the Output processor to print with fonts.

IMPORTANT:

Download fonts when the printer memory is cleared, or when the output just looks incorrect. This is done by following steps 'd' through 'f' above.

Always issue the 'assignfq' command before starting the printer, as in step 16) a).
Options
See Also font pitch-compile pitch-table download assignfq
Example
Warnings
Compatibility D3/RS6000
Referential Integrity & the Bridge Processing Code Index Level Spreadsheet Connective