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

World: r3wp

[Postscript] Emitting Postscript from REBOL

Geomol
8-Apr-2006
[370x4]
Example with different fonts:

write %test.ps postscript [[font [Verdana 20][at 72x700 "Verdana"] 
font [Helvetica 20] [at 72x650 "Helvetica"] font [Times-Roman 20] 
[at 72x600 "Times"]]]

I guess, it looks at the fonts installed on the system. I'm not sure, 
how 'clever' it is to guess the names.
It seems, that Times has to be named "Times-Roman". Here on my Mac, 
I have "Times" and "Times New Roman" installed, so I'm a bit confused.
Other valid fontnames: Times-Bold, Times-Italic, Times-BoldItalic
It's possible to use all different kinds of fonts. On my Mac, I have 
e.g. Papyrus, and combining fontnames with -Bold, -Italic and -BoldItalic 
is ok.
Anton
8-Apr-2006
[374]
Fantastic work guys!
Graham, perhaps a better name for view-ps-color is to-ps-color.
[unknown: 9]
8-Apr-2006
[375x2]
Yeah, in QML we ran into the same font problem.  So what we did was 
make Times, Helv, and Courier forced to be the defaults, then allowed 
any font name to be called as bassed to a variable as the real name 
of the font.  On windows you can have font names with spaces "Times 
New Roman" for example.  By have the top three just be one simple 
word everyone can remember I figured it would make people happy.
bassed = passed
Louis
8-Apr-2006
[377x2]
Henrik, are you sharing that new ean13.r file? If so, do you have 
a link?
The link in the old file doesn't work.
[unknown: 9]
8-Apr-2006
[379]
Also, let me confirm something, can I take any existiing PS file, 
and simply pass it to this, and it will render it?
Geomol
8-Apr-2006
[380x4]
Well, the dialect doesn't take PS as input, it produces PS. A PS 
file can be printed from REBOL in a way, Graham showed. Like:
>> port: open/direct tcp://192.168.1.253:9100
>> insert port read %boys-0-36-length-weight.ps
>> close port


192.168.1.253 is the IP of the printer, 9100 is the port, where the 
printer get data.
The dialect, I'm developing here, is for making it easier to produce 
PostScript output from within REBOL. Next step is to make a converter 
from the DRAW dialect to PostScript, so any DRAW data can be printed.
And now I'm at it, learning a bit PS and all, it'll make sense for 
me to make PS output from my NicomDoc format.
Reichart, the thing, you're asking, is taking a PS-file as input 
and render it, like GhostView does. It'll take a bit more work to 
parse PS-files, but it's not impossible. I have no intension doing 
that for now though.
[unknown: 9]
8-Apr-2006
[384]
Got it..............cool.
Henrik
8-Apr-2006
[385]
reichart, on your mac, Preview.app eats PS files for breakfast, in 
case you want to try that
Graham
8-Apr-2006
[386]
John, postscript uses a number of defined fonts.  Ignore the fonts 
on your system. The ones important are the ones in your postscript 
printer.
Henrik
8-Apr-2006
[387]
louis, check out http://www.hmkdesign.dk/rebol/barcode/

There are no docs, but I hope the demos are a bit explanatory
[unknown: 9]
8-Apr-2006
[388]
Henrik, thanks, I will play with it.  I have this great Mac sitting 
on my desk, but I don't seem to use it enough.


NOTE: I'm still tied to my PC, and TRYING to get away....so far it 
seems I'm held to just a couple of issues....I have not had time 
to write up the "PC MAC LINUX" chart I want so I can figure out what 
it takes for me to move over.  But the first big one is still a thumbnailer. 
 I use ThumbPlus.  If they were on Mac and Linux, then I think the 
move would be a lot better.  I use this about 10 times every day. 
 We can move this chat if you want to engage me on the Mac issue.
Graham
9-Apr-2006
[389x6]
John, just reading that link you gave to a postscript document structure, 
and I think we should change the prolog to say 
%!
instead of
%!PS-Adobe-3.0
as the latter says that the document is fully conforming.
The prolog is quite important to allow document managers to manage 
the postscript file properly.

It was interesting to note that postscript file managers can pull 
out the colour graphic pages and send them to be printed on colour 
lasers, and let the rest be printed on the monochrome lasers.
.. meant document print manager.
Looks like we need to terminate the document with a comment
%%EOF
the point of writing conforming postscript is that a manager might 
take that document and print it 2 or 4 up or whatever.
Looks like images can be incorporated into the ps file as hex data.
Geomol
9-Apr-2006
[395]
Graham, thanks for the info. I'll deal with these things in one of 
the following days.
Graham
10-Apr-2006
[396x3]
Just wondering whether it is preferable to build the dialect so that
postscript-dialect => postscript, or => draw

rather than trying to write a parser that converts draw to postscript.
I think the most common scenario for those of us wanting to do printing 
is to to compose a page, preview it and then print it.  This way, 
we have the one dialect that covers both bases.
the draw dialect is too low level I think for this.
[unknown: 9]
10-Apr-2006
[399x2]
Intersting...
So many dialects needed.
Graham
10-Apr-2006
[401]
dialects cover specific problem domains.
[unknown: 9]
10-Apr-2006
[402]
Oh, agreed....................my thought was simply how many dialects 
we are all working with, and how this number will grow until there 
is need for a new approach.


For example, XML is a dialect of sorts, for transmitting discrete 
data.  PS for rendering information in 2D.  HTML for rendering information 
in such a way that those that are challenged can us verbal readers, 
or physically challenged can ID links and important parts.  MakeDoc 
for converting  few symbols to complex rendering instructions that 
can be represented by HTML.
Graham
10-Apr-2006
[403]
Esperanto didn't cut it.
Gabriele
10-Apr-2006
[404x2]
Reichart, don't confuse language with dialect. PS and HTML are languages, 
not dialects (you can say that HTML is a dialect of SGML, to some 
extent).
i.e. there is no common ground between PS and HTML and so on.
Geomol
10-Apr-2006
[406x2]
I guess, the number of dialects is defined from the number of problem-domains. 
I think of them as the sub-languages different professions have. 
Doctors use their words, car-mechanics theirs, programmers yet other 
words and terms. So there might not be a limit for dialects, like 
there might not be a limit for new professions.
I think, it was Gregg, who pointed it out at last DevCon: Define 
a dialect, and you've solved the problem. Once you've defined the 
perfect dialect to solve some problem, the problem-solving code (programmed 
in the dialect) might just be 10 lines.
Graham
10-Apr-2006
[408]
Can we make this group web-public?
Geomol
10-Apr-2006
[409x3]
Ok by my.
me
(Damn, now the public will se, how bad my english is.) ;-)
Graham
10-Apr-2006
[412x2]
not if you hide behind a pseudonym!
Ok, made web-public .. can now point people to this thread who are 
interested in postscript.
Sunanda
12-Apr-2006
[414]
But remember they'll only see the most recent 300 messages.

So the more popular a group is, the less the public can see of it.

Maybe we need a [web-archive] flag too for groups that will be published 
in full [reply in chat as this is off-topic for postscript)
Geomol
13-Apr-2006
[415]
New version of postscript.r uploaded! I've add the prolog %! and 
epilog %%EOF as Graham suggested. I also wrapped paths in the postscripts 
commands gsave and grestore, so transformations give less trouble. 
Try this:

do http://home.tiscali.dk/john.niclasen/postscript/postscript.r

write %test.ps postscript load http://home.tiscali.dk/john.niclasen/postscript/test.txt


You now have a postscript file "test.ps" produced by the dialect. 
It's content looks like this:
http://home.tiscali.dk/john.niclasen/postscript/test.png

To see, how using the dialect look in use, see the "test.txt" file.
Henrik
13-Apr-2006
[416]
I'm building EAN13 barcode support for PS now. not very hard
Geomol
13-Apr-2006
[417x3]
The output postscript file from the dialect can be sent to a postscript 
printer, so no driver is needed.
Great, Henrik!
The dialect is just a version 0.2.3, so it can be better!