--- a/PostscriptPrinterStream.st Thu Sep 05 15:28:15 1996 +0200
+++ b/PostscriptPrinterStream.st Thu Sep 05 19:20:31 1996 +0200
@@ -12,7 +12,7 @@
PrinterStream subclass:#PostscriptPrinterStream
instanceVariableNames:'xPos yPos lineBuffer colNr lineNr fFamily fStyle pageStartAction
- pageEndAction'
+ pageEndAction pageCount'
classVariableNames:'Prolog Trailer PageProlog PageTrailer FontNames FontHeight
FontWidth LeftX TopY PageHeight LinesPerPage PhysicalPageHeight
Italic Bold Normal BoldItalic Courier Times Helvetica TopInset
@@ -272,21 +272,24 @@
Courier := 8. "/ # of courier base font
FontNames := #(
- '/Helvetica-Oblique'
- '/Helvetica-Bold'
- '/Helvetica-BoldOblique'
- '/Helvetica'
- '/Times-Italic'
- '/Times-Bold'
- '/Times-BoldItalic'
- '/Times'
- '/Courier-Oblique'
- '/Courier-Bold'
- '/Courier-BoldOblique'
- '/Courier'
- )
+ 'Helvetica-Oblique'
+ 'Helvetica-Bold'
+ 'Helvetica-BoldOblique'
+ 'Helvetica'
+ 'Times-Italic'
+ 'Times-Bold'
+ 'Times-BoldItalic'
+ 'Times'
+ 'Courier-Oblique'
+ 'Courier-Bold'
+ 'Courier-BoldOblique'
+ 'Courier'
+ )
- "Modified: 18.5.1996 / 09:37:48 / cg"
+ "
+ PostscriptPrinterStream initFonts
+ "
+
!
initPage
@@ -368,14 +371,25 @@
|tmpString t fontNr|
tmpString :=
-'%!!PS-Adobe-1.0
+'%!!PS-Adobe-2.0
%%Creator: Smalltalk/X
-%%DocumentFonts: Courier-Oblique Courier-Bold Courier Times-Italic Times-Bold Times
-save/SmalltalkJob exch def
+%%DocumentFonts: '.
+
+ FontNames do:[:aName |
+ tmpString := tmpString , aName , ' '
+ ].
+
+ tmpString := tmpString , '
+%%Pages: (atend)
+%%EndComments
+
+save /SmalltalkJob exch def
+
/OriginalState gstate def
/StartSmalltalkDoc{$smalltalk begin}def
/$smalltalk 50 dict def $smalltalk begin
/EndSmalltalkDoc{end}def
+
/S/show load def
/X{exch 0 rmoveto S}def
/Y{exch 0 exch rmoveto S}def
@@ -429,7 +443,7 @@
t := ''.
FontNames do:[:aName |
- t := t , '/ISO-' , aName , ' ' , aName , ' ISOrecode
+ t := t , '/ISO-' , aName , ' /' , aName , ' ISOrecode
'.
].
t := t , '
@@ -441,13 +455,14 @@
FontNames do:[:aName |
t := t , (fontNr printString) , ' '
, (FontHeight printString) , ' '
- , aName , (Character nl) asString.
+ , '/ISO-' , aName , (Character nl) asString.
fontNr := fontNr + 1
].
tmpString := tmpString , t.
tmpString := tmpString , fontNr printString , ' SetUpFonts
% end of prolog
+%%EndProlog
'.
Prolog := tmpString.
@@ -462,13 +477,12 @@
initTrailer
"define the documents epilog"
- Trailer :=
-'EndSmalltalkDoc
+ Trailer :=
+'
+EndSmalltalkDoc
SmalltalkJob restore
'
- "Created: 23.4.1996 / 19:55:24 / cg"
- "Modified: 23.4.1996 / 19:55:38 / cg"
!
initialize
@@ -662,6 +676,14 @@
!PostscriptPrinterStream methodsFor:'accessing'!
+pageCount
+ "returns the number of the currently printed page"
+
+ ^ pageCount
+
+ "Created: 5.9.1996 / 18:29:23 / cg"
+!
+
pageEndAction:something
"set pageEndAction - if non-nil, that will be called before
and EndPage is emmitted.
@@ -818,33 +840,37 @@
Send nothing if nativePrinting."
native == true ifFalse:[
- self endPage.
- super nextPutAllUntranslated:Trailer.
+ self endPage.
+ super nextPutAllUntranslated:'%%Pages: ' , pageCount printString.
+ super nextPutUntranslated:(Character cr).
+ super nextPutAllUntranslated:Trailer.
].
super endPrint
- "Modified: 23.4.1996 / 20:03:26 / cg"
+ "Modified: 5.9.1996 / 18:35:29 / cg"
!
startPrint
"start a document - send documentProlog & start a page.
Send nothing if nativePrinting."
+ pageCount := 1.
+
fFamily := Courier.
fStyle := Normal.
underline := false.
strikeout := false.
native == true ifFalse:[
- Prolog isNil ifTrue:[
- self class initialize
- ].
- super writingTo:(self class printCommand).
- super nextPutAllUntranslated:Prolog.
- self startPage
+ Prolog isNil ifTrue:[
+ self class initialize
+ ].
+ super writingTo:(self class printCommand).
+ super nextPutAllUntranslated:Prolog.
+ self startPage
]
- "Modified: 8.6.1996 / 08:16:50 / cg"
+ "Modified: 5.9.1996 / 18:29:34 / cg"
! !
!PostscriptPrinterStream methodsFor:'private'!
@@ -904,9 +930,11 @@
Should not be sent when nativePrinting."
self endPage.
+
+ pageCount := pageCount + 1.
self startPage
- "Modified: 23.4.1996 / 20:04:07 / cg"
+ "Modified: 5.9.1996 / 18:30:00 / cg"
!
placeString:aString at:pos
@@ -942,12 +970,15 @@
startPage
"start a page - send pageProlog, reset x/y position and line/col."
+ super nextPutAllUntranslated:'%%Page: ' , pageCount printString , ' ' , pageCount printString.
+ super nextPutUntranslated:(Character cr).
+
pageStartAction notNil ifTrue:[
- pageStartAction value
+ pageStartAction value
].
super nextPutAllUntranslated:PageProlog.
self class landscape ifTrue:[
- super nextPutAllUntranslated:'Landscape
+ super nextPutAllUntranslated:'Landscape
'.
].
@@ -959,7 +990,7 @@
lineNr := 1.
colNr := 0
- "Modified: 1.6.1996 / 00:44:10 / cg"
+ "Modified: 5.9.1996 / 18:30:08 / cg"
! !
!PostscriptPrinterStream methodsFor:'queries'!
@@ -1027,6 +1058,6 @@
!PostscriptPrinterStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/PostscriptPrinterStream.st,v 1.40 1996-09-05 13:28:15 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/PostscriptPrinterStream.st,v 1.41 1996-09-05 17:20:31 cg Exp $'
! !
PostscriptPrinterStream initialize!