n,"HP LaserJet Standard/Non-Standard 40"; {for BitFont 5.0 and up} t:cn="(c) Copyright 1988, 1989 Bruce J. Patin, 12-26-88, 05-30-89"; {This allows for a common non-standard font descriptor format, if the font descriptor length is 40 bytes} {initialize BitFont specific variables} a: aa=1; {allow adjacent dots. Only necessary to disallow for certain wire matrix printers.} x: df=1; {init data format to 1, Laser/CRT} x: xd=1; {single horizontal density} x: yd=1; {single vertical density} {you could also initialize the color variables in here, if desired} {declare and initialize the HP Character Descriptor variables:} x: zf=4;{byte 0: Descriptor Format, must be 4 for LaserJet} x: zx=0;{byte 1: Continuation, not supported by HP or BitFont} x: zs=14;{byte 2: Descriptor Size, must be 14 for LaserJet} x: cl=1;{byte 3: Class, bit data format, is 1 for LaserJet} x: or=0;{byte 4: Orientation, 0 = portrait, 1=landscape} {byte 5 is reserved, should be set to 0} x: lo=0;{byte 6,7: offset left edge of char to left edge of font cell} {landscape fonts will have negative values here} x: to=40;{byte 8,9: offset top of character to baseline} x: cw=30;{byte 10,11: character width, at 300 dots per inch, 30 is 1/10 inch} x: ch=50;{byte 12,13: character height, 50 dots is 6 lines per inch} x: ep=120,"Delta-X (quarter dots)"; {byte 14,15: distance from reference point to next character's} {declare and initialize the HP Font Descriptor variables} {note that values outside the ranges given here will usually result in the HP printer rejecting the downloaded font.} a: fd=26,"Font Descriptor size"; {byte 0,1: 26 is the minimum, 64 is max} {HP printers ignore beyond 26 so far.} a:z2=0; {byte 2 is reserved, should be set to 0} a: ft=1,"Font Type";{byte 3: 0 for 7-bit codes, 1 for 8-bit codes} a:z4=0; {bytes 4,5 reserved, set to 0} a: bl=40;{byte 6,7: distance from top edge of font cell to baseline} {baseline position may range from 0 to font cell height minus 1} a: fw=30;{byte 8,9: font cell width, must be from 1 to 255} a: fh=50;{byte 10,11: font cell height, must be from 1 to 255} a: oo=0;{byte 12: font orientation, 0=portrait, 1=landscape} {each character orientation must match or character is rejected} a: ks=0,"Spacing (0=fixed,1=prop)";{byte 13} a: ss=21,"Symbol Set";{byte 14,15: 21 is ANSI US ASCII} a: pt=120,"Pitch (quarter dots)";{byte 16,17} a: jh=200,"Height (quarter dots)";{byte 18,19} a: xh=0;{xHeight (quarter dots) byte 20,21, ignored by LaserJet} a: wt=0;{Width Type byte 22, ignored by LaserJet} a: st=0,"Style";{byte 23, 0=upright, 1=italics, 2=oblique} a: sw=0,"Stroke Weight";{byte 24} a: tf=0,"Typeface";{byte 25} {variables beyond this are currently ignored by HP printers.} {may be safest to ignore them also and set font descriptor size to 26} {some font developers have not followed the format beyond this point} a: sl=0;{Slant or reserved, byte 26} a: sf=0;{Serif Style, byte 27} a:z8=0;{28,29 reserved, set to 0} a: ud=-7;{Underline Distance (dots), byte 30} a: uh=3;{Underline Height (dots), byte 31, LaserJet is always 3} a: th=200;{Text Height (quarter dots), byte 32,33} a: tw=120;{Text Width (quarter dots), byte 34,35} a: fc=32;{First Code, byte 36,37} a: lc=255;{Last Code, byte 38,39} a: pe=0;{Pitch Extended (1024ths dot), byte 40} a: he=0;{Height Extended (1024ths dot), byte 41} a:z3=0;{bytes 42,43 reserved, set to 0} a:z7=0;{for bytes 44-45, in case they are not 0 in original font} a: fm=1;{bytes 44-47 font number, always 1 for LaserJet softfonts} t: fn="................";{Font Name (16 chars), bytes 48-63} {this is the end of the currently standard font descriptor} t:ex="";{any extended area between font descriptor and escape length.} a: d8=0; {d8=0 during font save to file, d8=1 for downloading} e; {end initialization section.} a: zt=0; {will get no font trailer message if not loading entire font} Ki1,"Load entire font."; {start input entire font.} Ki2,"Load font descriptor only."; {a little re-initialization first} a:z2=0; a:z4=0; a:z8=0; a:z3=0; a:z7=0; a:fm=1; t: fn="................"; t:ex=""; a: zt=1; {used to suppress no font trailer message} #:**, "Loading Font Descriptor "; L 2; u: za; j 2: za,ne,$1b; {look for esc} u: zb; j 2: zb,ne,$29; {look for ) } u: zc; j 2: zc,ne,$73; {look for s } d: zl; {escape sequence main data length} u: zz; {throw away term char} w: fd,"Font Descriptor size"; {font descriptor size} z 6:fd-2; {skip to end when length of font descriptor is reached} u: z2; {reserved} u: ft,"Font type"; w: z4; {reserved} w: bl; {Baseline Distance (dots)} w: fw; {Cell Width (dots)} w: fh; {Cell Height (dots)} a:aw=fw; a:ah=fh; a:bw=fw; a:bh=fh; {resize parms, for convenience} u: oo; {font overall orientation} u: ks,"Spacing (0=fixed,1=prop)"; w: ss,"Symbol Set"; w: pt,"Pitch (quarter dots)"; w: jh,"Height (quarter dots)"; w: xh;{reserved, was xHeight (quarter dots)} s: wt,"Width Type"; u: st,"Style"; s: sw,"Stroke Weight"; u: tf,"Typeface"; {****************} {section for non-standard descriptor if length 40} j 91,fd,ne,40; q: fn,,14,"Font Name"; {note that this is 14 bytes; standard is 16.} j 6; L 91; {fd not 40, continue with standard} {****************} u: sl,"Slant";{0 is normal} u: sf,"Serif Style"; w: z8; {reserved} s: ud,"Underline Distance (dots)"; u: uh,"Underline Height (dots)"; w: th,"Text Height (quarter dots)"; w: tw,"Text Width (quarter dots)"; w: fc,"First Code"; w: lc,"Last Code"; u: pe,"Pitch Extended (1024ths dot)"; u: he,"Height Extended (1024ths dot)"; w: z3; {reserved} w: z7; {reserved, or high order of font number} w: fm; {font number, always set to 1 for softfonts} q: fn,,16,"Font Name"; L 6;{ end of standard font descriptor} r;{reset length limit, just in case there is a bug} z 7:zl-fd; {set length limit to what's left of escape sequence data length} q: ex,,,"Extended area"; {allowed to terminate by next escape} L 7;{ end of font descriptor load} r;{reset length limit} Ei2; {end of font descriptor} L 8; j 12:fp,ge,fs; u: zz; j 8: zz,ne,$1b; {look for esc} u: zz; j 8: zz,ne,$2a; {look for * } u: zz; j 8: zz,ne,$63; {look for c } d: cc; {decimal code of character} u: zz; {throw away term char} L1; {label 1 to indicate start of character.} $ : cc,"Loading code (hex) "; L 11; u: zz; j 11: zz,ne,$1b; {look for esc} u: zz; j 11: zz,ne,$28; {look for ( } u: zz; j 11: zz,ne,$73; {look for c } d: zl; {length of character descriptor and data} u: zz; {throw away term char} u: zf; {format of descriptor} u: zx; {continuation} u: zs; {descriptor size} z 19:zs-1; u: cl; {class ( data format)} u: or; {Character Orientation} u: zz; {reserved} i: lo; {left offset} i: to; {top offset} w: cw; {character width} w: ch; {character height} i: ep; {endpoint} L 19; R; a: xl=zl-zs-2; {actual datalength} j 31: zx,ne,0; g:0,xl; {character data} a: xc=xl; L 31; j 32: zx,ne,1; g:xc,xl; {character data} a: xc=0; L 32; Ei4,1; {end character search, character loaded.} j 8; {go get next char} L 12; #:**,"Font loaded."; Ei1,2,0; {end entire font.} Ki4,"Load current character only."; {start search for an input character.} z 10:fs-fp; L 9; u: zz; j 9: zz,ne,$1b; {look for esc} u: zz; j 9: zz,ne,$2a; {look for * } u: zz; j 9: zz,ne,$63; {look for c } d: zc; {decimal code of character} $: zc,"Encountered code (hex): "; #: fp,"At file position: "; u: zz; {throw away term char} j 14: zc,eq,cc; L 13; u: zz; j 13: zz,ne,$1b; {look for esc} u: zz; j 13: zz,ne,$28; {look for ( } u: zz; j 13: zz,ne,$73; {look for c } d: zl; {length of character descriptor and data} u: zz; {throw away term char} p: fp + zl - 1; {position file past this character} j 9: zc,ne,cc; {looking for current code} L 14; # : cc,"Found code (dec)"; j 1; {found, go get it} L 10; {char not found} #A: zz,"Code not found. Hit return to continue."; Ei4; {end character search program (unsuccessful search)} Ko1,"Save entire font."; {start output entire font.} Ko2,"Save font descriptor only."; L 88; {for download} #:**, "Sending Font Descriptor "; u:$1b; u:$29; u:$73; d:fd+ex; {escape sequence main data length} y:"W"; {term char} z 46:fd; {set length limit} j 97: d8,ne,1; {skip fd override if not downloading} j 97: fd,ne,40; {skip fd override if fd<>40} w: 26; {fd override to fix nonstandard downloading problems} j 98; L 97; w: fd; {font descriptor size} L 98; u: z2; {reserved} u: ft; {font type} w: z4; {reserved} w: bl; {Baseline Distance (dots)} w: fw; {Cell Width (dots)} w: fh; {Cell Height (dots)} u: oo; {Orientation (0=portrt,1=landscp)} u: ks; {Spacing (0=fixed,1=prop)} w: ss; {Symbol Set for ss esc seq val = 1024, term char = A, ss=32769dec} w: pt; {Pitch (quarter dots)} w: jh; {Height (quarter dots)} w: xh; {xHeight (quarter dots)} s: wt; {Width Type} u: st; {Style} s: sw; {Stroke Weight} u: tf; {Typeface} {****************} {section for non-standard descriptor if length 40} j 92,fd,ne,40; j 93:fn,lt,14; {don't do next line if font name is less than 14} q: fn,0,14; {Font Name, should be 14 characters, truncated if more} j 46; L 93; {routine if fn is less than 14 and needs padding} t: ef=" "; {14 blanks, in case part needed for fname} a: el=16-fn;{calculate number of trailing blanks needed} q: fn; {font name} q: ef,0,el; {add trailing blanks to make 14} j 46; L92; {****************} u:sl; {Slant} u: sf; {Serif Style} w: z8; {reserved} s: ud; {Underline Distance (dots)} u: uh; {Underline Height (dots)} w: th; {Text Height (quarter dots)} w: tw; {Text Width (quarter dots)} w: fc;{First Code, byte 36,37} w: lc;{Last Code, byte 38,39} u: pe; {Pitch Extended (1024ths dot)} u: he; {Height Extended (1024ths dot)} w: z3; {reserved} w: z7; {high order word of font number} w: fm; {font number, always 1 for laserjet softfonts} j 61:fn,lt,16; {don't do next line if font name is less than 16} q: fn,0,16; {Font Name, should be 16 characters, truncated if more} j 46; L 61; {routine if fn is less than 16 and needs padding} t: ef=" "; {16 blanks, in case part needed for fname} a: el=16-fn;{calculate number of trailing blanks needed} q: fn; {font name} q: ef,0,el; {add trailing blanks to make 16} L 46; {end font descriptor output} r; {reset length limit} q: ex; {extended area, if any} Eo2; {end output font descriptor.} a:cc=0; {start with first possible code, zero} c; {select first valid code} j 57; {bypass first code check} L 55; c; {select first valid code} j 59:cc,eq,0; {go to 59 if no more valid codes} L 57; Ko4,"Append current character to output file.",A; {start output character} $ :cc,"Sending code (hex): "; u:$1b; u:$2a; u:$63; d: cc; {decimal code of character} u:$45; {term char} u:$1b; u:$28; u:$73; d: dl+16; {length of character descriptor and data} y:"W"; {term char} u:zf; {format of descriptor} u:zx; {continuation} u:zs; {descriptor size} u:cl; {class ( data format)} u:or; {Character Orientation} u:0; {reserved} i: lo; {left offset} i: to; {top offset} w: cw; {character width} w: ch; {character height} i: ep; {endpoint} g; {character data} Eo4; {end output character.} a:cc=cc+1; j 55; L 59; {end} j 89:d8,eq,1; {go finish download if downloading} Eo1; {end output entire font.} KP; {start download} a:d8=1; {downloading indicator} #a:id," Enter a font ID number (0 to 32767): "; u:$1b; u:$2a; u:$63; d:id; u:$44; j 88; {go save font to the printer} L 89; {now make it primary} a:d8=0; {turn off download indicator} u:$1b; u:$28; #:id," Font loaded as primary with ID: "; d:id; u:$58; EP; {end download} .