r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Postscript] Emitting Postscript from REBOL

Graham
5-Dec-2008
[1852]
Doesn't seem to work with layouts from rebgui

>> lo2: display "Test" [ text "hello" ]
>> unview/all
>> type? lo2
== object!
>> to-postscript lo2
** Script Error: Cannot use path on none! value
** Where: ps-face
** Near: if f/font/name [append font-name 'Helvetica]
if find
Henrik
5-Dec-2008
[1853x2]
perhaps the layout tree is different for rebgui
all to-postscript.r does is go through the layout tree and renders 
each object as a postscript color box with a text box on top of it. 
face values are just mapped into postscript.
Graham
5-Dec-2008
[1855x3]
the first place it barfs in this simple layout is here

        if f/font/name [append font-name 'Helvetica]
Which seems to say, if you have specified a font, ignore it and just 
use helvetica!
for Rebgui ... f/font is none
Henrik
5-Dec-2008
[1858]
I think that was supposed to be some kind of font mapping which wasn't 
finished.
Graham
5-Dec-2008
[1859x5]
Probably the best thing is to ensure the user uses the PostScript 
TTFs in their layouts
and then you can map
Let me check to see what mapping I use ...
; map postscript fonts to windows fonts
	fonts: [
Bookman-Demi
 "URW Bookman L Demi Bold"
Bookman-DemiItalic
 "URW Bookman L Demi Bold Italic"
Bookman-Light
 "URW Bookman L Light"
Bookman-LightItalic
 "URW Bookman L Light Italic"
Courier
 "Nimbus Mono L"
Courier-Oblique
 "Nimbus Mono L Regular Oblique"
Courier-Bold
 "Nimbus Mono L Bold"
Courier-BoldOblique
 "Nimbus Mono L Bold Oblique"
AvantGarde-Book
 "URW Gothic L Book"
AvantGarde-BookOblique
 "URW Gothic L Book Oblique"
AvantGarde-Demi
 "URW Gothic L Demi"
AvantGarde-DemiOblique
 "URW Gothic L Demi Oblique"
Helvetica
 "Nimbus Sans L"
Helvetica-Oblique
 "Nimbus Sans L Regular Italic"
Helvetica-Bold
 "Nimbus Sans L Bold"
Helvetica-BoldOblique
 "Nimbus Sans L Bold Italic"
Helvetica-Narrow
 "Nimbus Sans L Condensed"
Helvetica-Narrow-Oblique
 "Nimbus Sans L Condensed Italic"
Helvetica-Narrow-Bold
 "Nimbus Sans L Condensed Bold"
Helvetica-Narrow-BoldOblique
 "Nimbus Sans L Condensed Bold Italic"
Palatino-Roman
 "URW Palladio L Roman"
Palatino-Italic
 "URW Palladio L Italic"
Palatino-Bold
 "URW Palladio L Bold"
Palatino-BoldItalic
 "URW Palladio L Bold Italic"
NewCenturySchlbk-Roman
 "Century Schoolbook L Roman"
NewCenturySchlbk-Italic
 "Century Schoolbook L Italic"
NewCenturySchlbk-Bold
 "Century Schoolbook L Bold"
NewCenturySchlbk-BoldItalic
 "Century Schoolbook L Bold Italic"
Times-Roman
 "Nimbus Roman No9 L"
Times-Italic
 "Nimbus Roman No9 L Regular Italic"
Times-Bold
 "Nimbus Roman No9 L Medium"
Times-BoldItalic
 "Nimbus Roman No9 L Medium Italic"
Times-BoldOblique
 "Nimbus Roman No9 L Medium Italic"
Symbol
 "Standard Symbols L"
ZapfChancery-MediumItalic
 "URW Chancery L Medium Italic"
ZapfDingbats
 "Dingbats"
free 3 of 9 regular
 "FREE3OF9.TTF"
]
the last one is a bar code font I use
Geomol
8-Feb-2009
[1864x2]
I just realized, my postscript pages are gone with my old homepage. 
Moving things over to ...
Postscript dialect: http://www.fys.ku.dk/~niclasen/postscript/postscript.r

Documentation: http://www.fys.ku.dk/~niclasen/postscript/postscript.html

Test (see also documentation): http://www.fys.ku.dk/~niclasen/postscript/test.txt
Henrik
8-Feb-2009
[1866]
I'm still working on my VID->Postscript thing. I will need it for 
work on a paper layout GUI later this month, so there will be some 
progress there.
Geomol
26-Feb-2009
[1867x2]
It seems, that something called IPS PS3 is in printers from HP and 
Xerox, so they understand PS directly:
http://www.zoran.com/IPS-PS3


It could be interesting to find out, how many printers can print 
PS directly without a driver. Just sending to port 9100 on the printer, 
as described in the REBOL postscript docs.
A world without printer drivers is a better world! (TM)
Henrik
26-Feb-2009
[1869]
It could be interesting to find out, how many printers can print 
PS directly without a driver.

 <- I've not yet seen one that does. Even for postscript, there is 
 apparently a need to adjust for bugs in the printer hardware.
Geomol
26-Feb-2009
[1870]
A HP LaserJet 4000, I have access to, seem to print PS just fine 
without the need for a driver.
Henrik
26-Feb-2009
[1871]
I managed to lock up my brothers HP Laserjet 4500 with a PDF file. 
That was interesting :-)
kib2
26-Feb-2009
[1872]
Does the produced PostScript file contains any bounding-box (to make 
an eps one )?
Geomol
26-Feb-2009
[1873]
No, if you need it, you can add it. :-)
Graham
26-Feb-2009
[1874]
Most of HP's commercial printers have embedded postscrript interpreters. 
 It's only their home printers that don't.
Robert
26-Feb-2009
[1875]
I will give it a try on my OfficeJet thing. Pretty old and I'm mostly 
sure it won't work. Any good PS file for the test?
Geomol
26-Feb-2009
[1876]
A simple test page: http://www.fys.ku.dk/~niclasen/postscript/test.ps
Graham
26-Feb-2009
[1877]
Officejet sounds like an inkjet ... unlikely to have PS.
Robert
26-Feb-2009
[1878]
He, good point Graham. Whereas I don't understand what influence 
this has on PS interpreter...
Graham
26-Feb-2009
[1879x2]
Mass distribution printers .. the added cost of installing a PS interpreter, 
ram etc.
all cost driven.
DideC
27-Feb-2009
[1881]
Most cheap printer are dumb. The power is in the driver: the computer 
does the job then send raw command to the printer controller. They 
are often called "Winprinter" because of the usually Windows only 
driver they provide (well, not so true today as it used to be a few 
years ago).


Expensive printers include processor, RAM and the firmware to understand 
the print command by themself. PCL or PS ones (but it exists other 
languages like on Kyocera printers, I have done things for that 12 
years ago).
Robert
27-Feb-2009
[1882]
I thought these days, that you just plug-in an embedded Linux, use 
ghostscript and that's it.
Gabriele
1-Mar-2009
[1883]
That still costs money (CPU, RAM, Flash, ...)
Geomol
3-Mar-2009
[1884]
There seems to be a problem with printing parenthesis in my postscript 
dialect. Henrik, I guess, you use this dialect. Did you come across 
this problem?

Others using this postscript dialect?
Henrik
3-Mar-2009
[1885]
I've not encountered it. What goes wrong?
Geomol
3-Mar-2009
[1886x2]
It seems, if parenthesis are not balanced in a string, the output 
is rubbish. I found in the ref manual, that some special characters 
need to be escaped with: \
I've made a new version, I'll upload soon.
See Announce
Henrik
3-Mar-2009
[1888]
thanks
Geomol
5-Mar-2009
[1889]
Henrik, have you ever done landscape with the dialect?
Henrik
5-Mar-2009
[1890x2]
I have tried, but stopped again due to problems with determining 
whether the dialect itself should create a landscape document or 
the printer driver. So I just usually make a portrait document and 
rotate everything 90 degrees.
Also Ghostscript and Preview.app interpret paper orientation and 
size information differently. Ghostscript tends to be more correct, 
it seems.
Geomol
5-Mar-2009
[1892]
Ok, I just wanted to check the ways, we eventually did it. I do this:

PageSize A4
font [Times 7]
page [rotate 90 translate 0x-842
...
]


I use the offset 8x834 for the first line of text on the paper, no 
matter if it's landscape or not. It works.
Geomol
10-Mar-2009
[1893]
Minor update of the documentation: http://www.fys.ku.dk/~niclasen/postscript/postscript.html
Geomol
11-Mar-2009
[1894x3]
PDF output from the PostScript dialect is ready for some test. The 
script is here:
http://www.fys.ku.dk/~niclasen/postscript/rebps2pdf.r

It works the same as the postscript.r script:
http://www.fys.ku.dk/~niclasen/postscript/postscript.r
(which has been updated, as I found some problem with comments)

Example of use:

do http://www.fys.ku.dk/~niclasen/postscript/rebps2pdf.r

write/binary %pdftest.pdf rebps2pdf load http://www.fys.ku.dk/~niclasen/postscript/pdftest.txt

Now you should have a local %pdftest.pdf file, that looks like:
http://www.fys.ku.dk/~niclasen/postscript/pdftest.pdf
Center- and right-alignment of text isn't as easy in PDF as in PostScript, 
so this is left out. See:
http://www.adobeforums.com/webx/.3bc3e853
I also found, that images seems to work in a weird way with the postscript.r 
script producing PostScript output. I have to test this some more. 
For now, scaling images to 72x72 should mean images in 72 dpi. Maybe 
this isn't a good way to scale?
Anton
12-Mar-2009
[1897x2]
The question is, what is the physical size of a rebol image?
The image! datatype doesn't tell you. It must be asserted separately. 
But where, by who?
Henrik
12-Mar-2009
[1899]
Anton, that's a pretty good question.
Pekr
12-Mar-2009
[1900]
Physical size, as in bytes? What about X*Y*4?
Geomol
12-Mar-2009
[1901]
I found a bug when specifying ImageMatrix in postscript.r

I've fixed it and uploaded a new version. Now images should work 
the same in postscript.r and rebps2pdf.r