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