News for hackers. Stuff that matters.
Re:Why “direct” PostScript makes sense by SimHacker on Friday December 09, 2011 @06:43AM (#3333396)
I've written piles of "Direct PostScript" code for the NeWS window system -- http://en.wikipedia.org/wiki/NeWS ...

Pie menu widget: http://www.donhopkins.com/home/code/piemenu.ps.txt

PizzaTool graphical Pizza ordering gui: http://www.donhopkins.com/home/code/pizzatool.ps.txt Illustration: http://www.donhopkins.com/home/catalog/images/pizzatool.gif

VT100 terminal emulator: http://www.donhopkins.com/home/code/newterm.ps.txt

UniPress (Gosling) Emacs display driver: http://www.donhopkins.com/home/code/emacs.ps.txt

Metacircular PostScript interpreter: http://www.donhopkins.com/home/code/ps.ps.txt

PSIBER Space Deck (visual PostScript debugger and programming environment): http://www.donhopkins.com/home/code/litecyber.ps.txt More about that: http://www.donhopkins.com/drupal/node/97

A lunar lander game James Gosling wrote in 1988: http://www.donhopkins.com/home/code/lander.ps.txt

HeapSort by Owen Densmore: http://www.donhopkins.com/home/code/heapsort.ps.txt

QuickSort by Don Woods (an incredibly twisty maze of stack manipulation, by the Adventure dude): http://www.donhopkins.com/home/code/quicksort.ps.txt

BubbleSort by Bobo Leffler (he was afraid this might come back to haunt him): http://www.donhopkins.com/home/code/bubblesort.ps.txt

Re:Why “direct” PostScript makes sense by bazzargh on Friday December 09, 2011 @08:00AM (#3333537)
Since we're all admitting to have done this at one point in the past, here's mine; PSTab, a guitar tablature typesetter I wrote in 1994. The code is...not great. http://www.ctan.org/tex-archive/support/pstab

I heard from a guy in NZ a while after that he'd used it to typeset a book of banjo music - it was the only software he could find that supported anything other than 6 strings.

Re:Why “direct” PostScript makes sense by chalst on Friday December 09, 2011 @06:29AM (#3333370)
PDF displaced Postscript for two reasons: (i) lower resource usage, and (ii) better handling of fonts.

Since then PDF has become more sophisticated, handling metadata, tagging, and embedding media. It's been a long time since Postscript has been "the universal language for graphical and printed work".

A shame, since Postscript is fun.

Re:Why “direct” PostScript makes sense by gallerytungsten on Friday December 09, 2011 @09:16AM (#3333732)
re: "PDF displaced Postscript."

Not exactly. A PDF is generated from PostScript, as noted in the article:

"A PDF file is a static representation of the result of executing the PostScript file on a single occasion."

A PDF is a more compact version of a PostScript file - we could call it compiled PostScript, to use a term many on this site are familiar with. Just as a compiler has many output options, distilling PostScript can result in many different file sizes and levels of quality. (Check out the Distiller output settings.)

Re:Why “direct” PostScript makes sense by plt on Friday December 09, 2011 @02:39PM (#3335229)
PDF is typically directly generated these days. There's no need to generate it from PostScript first.

The main difference between the two is that PDF is a declarative definition of the page whereas PostScript is a turing complete language. You can write a PostScript ray-tracer which will execute on the printer itself something which would never be possible in PDF. On the flip side, PDF is far more efficient as an electronic document format.

Re:Why “direct” PostScript makes sense by mattlong on Friday December 09, 2011 @02:59PM (#3335306)
No, PDFs don't have to be generated from PS at all. PDF has it's own well-defined spec. Valid PDF files can be generated in many ways besides from PS files. It's even possible to write a valid PDF file by hand if you're feeling masochistic.
Re:Why “direct” PostScript makes sense by Craiggybear on Friday December 09, 2011 @07:51AM (#3333526)
"It's been a long time since Postscript has been "the universal language for graphical and printed work""

That's actually not true. There's LOTS of PS files in workflows in commercial printing -- I know because I write software for the print industry.

Its true PDF is often replacing the PS file but these are NOT without their own set of problems.

Re:Why “direct” PostScript makes sense by protomyth on Friday December 09, 2011 @10:10AM (#3333927)
My first job out of college, I had a Turbo C compiler, a DEC PC, a database app (government) written in Foxbase, and a Postscript printer. No real reporting tools, so all my reports and add-ons were written in C and outputted Postscript directly to the printer. Was a very interesting learning experience.

The Blue and Green books are a must for a new Postscript programmer http://partners.adobe.com/public/developer/ps/sdk/index_arch...

Re:Why “direct” PostScript makes sense by RodgerTheGreat on Friday December 09, 2011 @09:19AM (#3333741)
Here's a toy Forth compiler, VM and visual debugger I wrote in PostScript:

https://github.com/JohnEarnest/Four.Ps/blob/master/four.ps

Re:Why “direct” PostScript makes sense by ableal on Friday December 09, 2011 @11:17AM (#3334231)
A few years ago I took a look at this Unix circuit schematic editor, which seems to be still going strong. Symbols are kept directly in Postscript, if memory serves.

http://opencircuitdesign.com/xcircuit/ : "XCircuit regards circuits as inherently hierarchical, and writes both hierarchical PostScript output and hierarchical SPICE netlists."

Re:Why “direct” PostScript makes sense by DennisP on Friday December 09, 2011 @01:31PM (#3334869)
It'd be really cool to have an ebook reader that converts epub files, and runs either TEX directly or postscript implementing the TEX paragraph formatter.

It's really bugging me that my kindle is incapable of running Knuth's algorithm, preferring instead to avoid hyphenation entirely, serving up an ugly hodgepodge of justified and ragged-right text. C'mon guys, this is old stuff...

Any open hardware with e-ink?

Re:Why “direct” PostScript makes sense by ChuckMcM on Friday December 09, 2011 @07:41PM (#3336392)
Sadly the iRex Technologies Illiad is no longer available (but it met your criteria)
Re:Why “direct” PostScript makes sense by bitwize on Friday December 09, 2011 @12:32PM (#3334583)
When I wanted to investigate fractals using Scheme, I had the Scheme program spit out PostScript output, then ran it through gs to look at the results.

PostScript is really tractable as a language to work directly in. Basic line-drawing stuff is almost as simple as the Logo I played with as a kid.

Re:Why “direct” PostScript makes sense by thristian on Friday December 09, 2011 @05:23AM (#3333264)
I'm not sure I'd ever try it myself — for one thing, PostScript would only be useful for preparing documents destined for print, not HTML — but if I ever did need such a thing, I'd be interested to try it out.
Re:Why “direct” PostScript makes sense by mhd on Friday December 09, 2011 @05:36AM (#3333282)
Whether the rasterization in the end targets a printer or it ends up in a .png doesn't really matter at all.

But yeah, sadly there's no readily available system nowadays with true Display PostScript. Not very likely that Oracle will release the NeWS sources, and OS X switched to DirectPDF.

Have to check GNUStep…

Re:Why “direct” PostScript makes sense by Craiggybear on Friday December 09, 2011 @05:52AM (#3333312)
Yes, OS X uses direct PDF to write to the screen, and will helpfully rasterise PS to PDF on the fly.

The 3B2 typesetting system does write display PS to the screen, though. Even the old DOS version.

Re:Why “direct” PostScript makes sense by krupan on Friday December 09, 2011 @12:33PM (#3334585)
That's a whole lot of text with very, very few code examples. Is the code too scary to show us more?
Re:Why “direct” PostScript makes sense by gilgameshi on Friday December 09, 2011 @09:31AM (#3333775)
Killed because it was very copyrighted...

Time to move on guys. Any newer ideas?

Re:Why “direct” PostScript makes sense by DennisP on Friday December 09, 2011 @01:26PM (#3334836)
Ghostscript runs postscript and is opensource.
Re:Why “direct” PostScript makes sense by Craiggybear on Friday December 09, 2011 @05:48AM (#3333304)
I like hand-coding PostScript. Been doing it since the early 90's. It doesn't need to be a mess and can be beautifully concise and clean. It does have some odd ideas for the beginner (the page always starts at the bottom left coordinate and goes up, not down) but that's not hard.

Its a very cool language -- Forth derived.

Re:Why “direct” PostScript makes sense by mhd on Friday December 09, 2011 @06:14AM (#3333342)
I remember back in the days of "early" Linux, when printer drivers were still a bit rare, there was lots of software that generated somewhat readable PS, i.e. the programmers wrote it and then used it as a template, like you'd be using HTML templates nowadays. The timetables for a German railway info site did that.

And I made heavy use of Jamie Zawinski's audio-tape.ps [1] back then. Never got through Thinking in PostScript [2] completely, though…

1: http://www.jwz.org/hacks/audio-tape.ps

2: http://wwwcdf.pd.infn.it/localdoc/tips.pdf

Re:Why “direct” PostScript makes sense by salvadors on Friday December 09, 2011 @12:19PM (#3334523)
Wow. I'd completely forgotten about audio-tape.ps. It had all sorts of nifty built-in graphics for various bands, and I remember learning way more than I ever expected to want to know about PostScript adding similar customisations for others.
Re:Why “direct” PostScript makes sense by acqq on Friday December 09, 2011 @06:10AM (#3333339)
I like to write Perl scripts which generate Postscript pictures. It gives me better interactivity of Perl development combined with the exactness of the results of Postscript.

The end result is usually a PDF file.

Still I've never learned to embed external fonts in my scripts, does anybody have some straightforward text about that part? As far as I know I'm legally 100% clean if I manage to use any font as long as I only distribute the PDF at the end.

Re:Why “direct” PostScript makes sense by fhars on Friday December 09, 2011 @06:33AM (#3333377)
It's been a long time since, but as far as I remember it basically boils down to pasting the pfa into your file (pfb2pfa is your friend here).

And it totally is a murky legal situation, many fonts don't allow embedding into a pdf, and you may not use almost all fonts in any way at all if you do not have a valid license. Fonts in the abstract may or may not be copyrightable depending on where you live, but the actual pfa-code you put in your file and the representation generated from that when converting to PDF definitely are.

Re:Why “direct” PostScript makes sense by bazzargh on Friday December 09, 2011 @08:12AM (#3333559)
You might want to try cairo for that instead. It has PS and PDF backends which are pretty direct (see the bottom of this page http://cairographics.org/documentation/using_the_postscript_...), and it'll take care of font subsetting and embedding for you, if that font allows it.
Re:Why “direct” PostScript makes sense by Craiggybear on Friday December 09, 2011 @07:49AM (#3333521)
You need the T1ASCII utility to convert your binary Type1 PS Font to a Type3 ASCII font. You can then embed the font as a PS resource and call it from within your PS file as you would normally.

T1Utils is the package and can be found from your repository or synaptic. There's also a DOS version and it comes with its c code.

Re:Why “direct” PostScript makes sense by davidhansen on Friday December 09, 2011 @09:33AM (#3333783)
Nice. FWIW, We emit "direct" postscript for most of our generated warehouse documents like packing slips, gift cards, snail-mail gift certificates, invoices, etc.