Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Postscript Support Testing
Last updated at 10:30 am UTC on 12 March 2002
Test log

FileIn test in image version 2.5


FileIn EncodingFilters_11Sep632pm.cs followed
by fileIn of Morphic-PS-6_12Aug1020am.cs
in an new image von version 2.5 on Windows
was successful.


Simple test



The follwing test was sucessful.

  1. Evaluation of

    p _ PasteUpMorph new extent: 300 @ 200.
    p addMorph: (EllipseMorph new position: 10 @ 10).
    p addMorph: (EllipseMorph new extent: 30 @ 30;
    position: 70 @ 10;
    color: Color red).
    p addMorph: (TextMorph new position: 20 @ 80;
    contents: 'Postscript test 13-Sep-1999').
    p position: 25 @ 25.

    p openInWorld.

    (FileStream newFileNamed: 'test1.eps')
    nextPutAll: (EPSCanvas morphAsPostscript: p);
    close.



  2. Insertion of test1.eps into an MSWord document

  3. printout on a Postscript printer



Questions
  1. There was no preview within MSWord. This is OK for the time beeing.
    Within the encapsulated post script graphic (eps) an empty title string was showed. Is it already
    possible to set this title string when generating the eps? If not I would
    suggest to implement this next, as this helps considerably if one is working
    with multiple eps files.

  2. Are the Postscript operations implemented as low level replacements of the Morph
    drawing methods? Are all kinds of morphs processed?

  3. Should the package be used the way as in the example? Or should other possiblities
    be preferred?

[13-Sep-1999/ hjh]
[14-Sep-1999/ hjh] Questions answered by MPW, 14 Sept 1999, see Postscript support; suggestion of question 1 implemented!



[13-Sep-1999/ BJP]
I tried this and it worked like a charm. Didn't import it into word, but I did convert it to SPDF with Ghostscript.

I think this is a nice example of how to do things programmatically (so maybe should go in as a class method as an example somewhere), but the "clip as postscript" command is really nifty.


[15-Sep-1999/ hjh]

Second test - eps file size


  1. File in the Postscript package as above.

  2. Evaluate

    p := PasteUpMorph new extent: 600 @ 640.
    t := TextMorph new.
    t contents: 'PolygonMorph shapeFromPen: aBlock color: aColor borderWidth: anInteger borderColor: anotherColor'.
    t position: 0@300.
    p addMorph: t.
    t addFlexShell.
    t owner rotationDegrees: -90.



    pgm := PolygonMorph
    shapeFromPen: [:p1 |
    p1 hilbert: 6 side: 4.
    p1 go: 5.
    p1 hilbert: 6 side: 4.
    p1 go: 5.]
    color: Color red borderWidth: 1 borderColor: Color black.
    pgm position: 320@50.
    p addMorph: pgm.

    1 to: 40 do:
    [ :i | r := RectangleMorph new
    extent: (side _ i
    5+40) @
    (2
    side).
    i odd ifTrue: [r color: Color blue]
    ifFalse: [r color: Color orange].
    r position: 30@70. p addMorphBack: r].
    p openInWorld.



  3. Bring up the menu of the pastUpMorph and select 'clip As Postscript'

  4. Paste the content of the clipboard into a text editor

  5. Save it as a 'text only' file with the extension .eps. The files size is 144kB.

  6. Open it with Ghostscript View (GSView)version 2.7 or higher.

  7. Result: It displays properly

  8. In GSView use "print" and choose as printer "pdfwrite", resolution 300 and save it as 'example2.pdf'.

  9. The resulting file is of size 43kB. Open it with Adobe Acrobat (version 3 was used)

  10. Result: It is displayed partly and a message box appears with a text like 'error in processing or data too complex'



Retest
In the Smalltalk code

p1 hilbert: 6 side: 4.
was replaced on the two occurrences with

p1 hilbert: 5 side: 7..

Result: The eps file size was 49kB. The pdf file size was 14kB. It was displaye OK in Adobe Acrobat as well.

The test was conducted on a Windows PC (Win95), 96MB RAM, Squeak, GSView and Acrobat opened at the same time.


Comment
The Squeak PS package performs well as is shown by GSView. The conversion to PDF by GSView or the display by Adobe Acrobat has a rather low limit on the number of PS commands that can be processed.



The Postscript package has been included into Squeak version 2.6alpha




From: Alexander Lazarevic
Date: Thu, 23 Sep 1999 10:21:30 +0200 (CEST)
Subject:

[BUG?] Postscript Output mirrored?



When I write a World to a Postscript file with
worldAsPostscriptRotated: I get an upside-down and mirrored
picture. Nothing changes when I set the rotateFlag to true.

Here is one example: (Not torturing the list with the pics, just some
links)

http://www.cs.uni-magdeburg.de/~lazarevi/squeak/mirror.ps
http://www.cs.uni-magdeburg.de/~lazarevi/squeak/mirror.ps.gz
http://www.cs.uni-magdeburg.de/~lazarevi/squeak/mirror.jpg

Am I missing a configuration switch that I have to set before creating
the postscript data?

Alexander Lazarevic



Marcel Weiher answered:
Subject: Re: [BUG?] Postscript Output mirrored?
Date: Thu, 23 Sep 1999 13:02:55 +0200

The rotateFlag hadn't been connected yet. Attached below are some
(very) quick (and dirty!) fixes that should do the trick for now.

Also, you might want to (should) use EPSCanvas to do 'screen grabs'.

(FileStream newFileNamed: '/tmp/Squeak-Rules.eps')
nextPutAll: (EPSCanvas
worldAsPostscriptRotated:true); close.


Looking at the Postscript output, there also seems to be some
page-setup code missing. I'll look into it after I've gotten updates
from the server.


PostscriptCanvas class methods

worldAsPostscriptRotated:rotateFlag
^self morphAsPostscript:World rotated:rotateFlag
offsetBy:(rotateFlag ifTrue:[0@0] ifFalse:[self baseOffset]).


morphAsPostscript:aMorph rotated:rotateFlag offsetBy:offset
| psCanvas bounds |
psCanvas _ self new.
psCanvas reset.
psCanvas bounds:(offset extent:aMorph bounds extent).
rotateFlag ifTrue:[
bounds _ psCanvas bounds.
bounds _ bounds topLeft extent: bounds height @ bounds width.
psCanvas bounds:bounds.
].
psCanvas topLevelMorph:aMorph.
psCanvas resetContent.
rotateFlag ifTrue:[
psCanvas target print:' 90 rotate 0 '; write:bounds width
negated; print:' translate'; cr.
].
psCanvas fullDrawMorph: aMorph .
^psCanvas contents.





Dan Ingalls added that his update (#1476) might give conflicts.
Date: Thu, 23 Sep 1999 06:27:32 -0800
Subject: Re: [BUG?] Postscript Output mirrored?

I should explain that I added the very minimum to make it easy to=
print PS files from any given morph, My very latest update (#1476) only late last night may conflict with these changes, but I believe it handles rotation correctly for most cases. It's possible that I even broke something. We still need a model for page size that can be set in a class
var, and the ability to "scale to fit" on whatever the current page size is.

Marcel has done a wonderful job, especially his overnight hack that makes the BTF paper look so nice.

At this point, I will bow out of the PS integration effort, and perhaps when the dust settles, Marcel or someone can send along a collection of enhancements and fixes for me to forward as an official update.

- Dan

The above three emails pasted into this page by hh / 23-Sept-99


Please add more test reports ....