author | Claus Gittinger <cg@exept.de> |
Mon, 15 Jul 2019 15:39:26 +0200 | |
changeset 5054 | b01df68cba0a |
parent 4538 | 6f8d97524948 |
child 5175 | 75c026242bf0 |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
84 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
4196 | 12 |
"{ Package: 'stx:libbasic2' }" |
0 | 13 |
|
4196 | 14 |
"{ NameSpace: Smalltalk }" |
1317 | 15 |
|
0 | 16 |
PrinterStream subclass:#HPLjetIIPrinterStream |
259 | 17 |
instanceVariableNames:'' |
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
1649 | 20 |
category:'Interface-Printing' |
0 | 21 |
! |
22 |
||
1317 | 23 |
!HPLjetIIPrinterStream class methodsFor:'documentation'! |
31 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
84 | 28 |
All Rights Reserved |
31 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
41 |
This class defines protocol for simple text prinitng on an HP Laserjet 2/3 |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
42 |
(and compatible) printer. |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
43 |
It does not support multiple fonts, but knows how to print bold, italic etc. |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
44 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
45 |
Graphics printing is not supported - you need a postscriptprinter for this. |
259 | 46 |
|
348 | 47 |
Notice: |
48 |
This class only defines some minimum protocol for printing on |
|
49 |
HP-LJ - you really should use a PostscriptPrinter ... |
|
50 |
... however, if you own a LJ, here is some class to start with. |
|
51 |
It may need to be enhanced at some places (for example: provide more |
|
52 |
fonts/emphasis's, better international character translation, |
|
53 |
image printing etc.) |
|
54 |
||
4196 | 55 |
[Disclaimer:] |
348 | 56 |
This class is not officially supported - take it or leave it. |
57 |
||
259 | 58 |
[author:] |
59 |
Claus Gittinger |
|
31 | 60 |
" |
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
61 |
! ! |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
62 |
|
1317 | 63 |
!HPLjetIIPrinterStream class methodsFor:'initialization'! |
441 | 64 |
|
65 |
initialize |
|
66 |
DefaultCommands := #('lpr' |
|
67 |
'lpr -P<your-printer>' |
|
68 |
'cat | rsh <printHost> lpr -h' |
|
69 |
). |
|
70 |
super initialize |
|
71 |
||
72 |
" |
|
73 |
self initialize |
|
74 |
" |
|
75 |
||
76 |
! ! |
|
77 |
||
1317 | 78 |
!HPLjetIIPrinterStream class methodsFor:'queries'! |
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
79 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
80 |
printerTypeName |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
81 |
"return a descriptive name" |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
82 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
83 |
^ 'hp laserjet III compatible printer' |
31 | 84 |
! ! |
85 |
||
4538 | 86 |
!HPLjetIIPrinterStream methodsFor:'access-writing'! |
0 | 87 |
|
348 | 88 |
cr |
89 |
"send a carriage-return (newLine) to the printer. |
|
90 |
We have to output cr-nl here" |
|
91 |
||
92 |
super nextPutUntranslated:(Character value:13). |
|
93 |
super nextPutUntranslated:(Character value:10). |
|
370 | 94 |
self spaces:self class leftMargin |
348 | 95 |
|
370 | 96 |
"Modified: 1.6.1996 / 00:13:42 / cg" |
1317 | 97 |
! |
98 |
||
99 |
nextPut:aCharacter |
|
100 |
stream nextPut:aCharacter |
|
348 | 101 |
! ! |
102 |
||
103 |
!HPLjetIIPrinterStream methodsFor:'emphasis change'! |
|
104 |
||
126 | 105 |
bold |
348 | 106 |
"switch to bold emphasis" |
0 | 107 |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
108 |
"send <ESC>(s0S<ESC>(s3B" |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
109 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
110 |
super escapeAll:'(s0S'. |
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
111 |
super escapeAll:'(s3B' |
348 | 112 |
|
113 |
"Modified: 18.5.1996 / 09:10:39 / cg" |
|
0 | 114 |
! |
115 |
||
348 | 116 |
italic |
117 |
"switch to italic/oblique emphasis" |
|
118 |
||
119 |
super escapeAll:'(s1S'. |
|
120 |
super escapeAll:'(s0B' |
|
121 |
||
122 |
"Modified: 18.5.1996 / 09:10:44 / cg" |
|
123 |
! |
|
124 |
||
125 |
normal |
|
126 |
"switch to normal/roman emphasis" |
|
127 |
||
128 |
super escapeAll:'(s0S'. |
|
129 |
super escapeAll:'(s0B' |
|
130 |
||
131 |
"Modified: 18.5.1996 / 09:10:48 / cg" |
|
132 |
! ! |
|
133 |
||
134 |
!HPLjetIIPrinterStream methodsFor:'font change'! |
|
135 |
||
0 | 136 |
courier |
137 |
"switch to courier font" |
|
138 |
||
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
139 |
super escapeAll:'(s3T' |
0 | 140 |
! |
141 |
||
142 |
helvetica |
|
143 |
"switch to helvetica font" |
|
144 |
||
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
145 |
super escapeAll:'(s4T' |
0 | 146 |
! |
147 |
||
126 | 148 |
times |
149 |
"switch to times font" |
|
150 |
||
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
126
diff
changeset
|
151 |
super escapeAll:'(s5T' |
0 | 152 |
! ! |
259 | 153 |
|
1317 | 154 |
!HPLjetIIPrinterStream class methodsFor:'documentation'! |
259 | 155 |
|
156 |
version |
|
4196 | 157 |
^ '$Header$' |
259 | 158 |
! ! |
1317 | 159 |
|
4196 | 160 |
|
441 | 161 |
HPLjetIIPrinterStream initialize! |