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