summaryrefslogtreecommitdiff
path: root/bk_ps.c (follow)
Commit message (Collapse)AuthorAge
* Revamp of the Halibut error handling mechanism.Simon Tatham2012-08-29
| | | | | | | | | | | | | | | | I'm not quite sure why I ever thought it was a good idea to have a central variadic error() function taking an integer error code followed by some list of arguments that depend on that code. It now seems obvious to me that it's a much more sensible idea to have a separate function per error, so that we can check at compile time that the arguments to each error call are of the right number and type! So I've done that instead. A side effect is that the errors are no longer formatted into a fixed-size buffer before going to stderr, so I can remove all the %.200s precautions in the format strings. [originally from svn r9639]
* Allow a hastily selected subset of the output formats to also acceptSimon Tatham2009-10-24
| | | | | | | | | | | | | | | | | | | | "-" as a special file name meaning standard output. I've restricted it to just those output formats which can predictably output only one file, just for the sake of not having to faff too much with the others. Probably what I should have done for all of this would have been to write a set of wrappers around fopen, fclose and everything in between, and use them everywhere. Those wrappers would uniformly detect "-" and convert it into stdin or stdout as appropriate, would avoid fclosing those files for real when told to close them, and would also be able to handle reading a little bit of data from the start of a file and then pushing it all back even if the file were not seekable (which would allow input.c to lose the ugly special case whereby it can't currently read font files from standard input). [originally from svn r8729]
* Make ps_token() more generally available and use it to improve the formattingBen Harris2007-02-06
| | | | | | of Type 42 fonts. [originally from svn r7245]
* Add support for using TrueType fonts, including embedding in PostScript butBen Harris2007-02-03
| | | | | | | not yet in PDF. There's a lot of cleaning up to be done, especially in the area of error, but I think it would be better committed gradually. [originally from svn r7198]
* Add support for PFB files. This seems to have caused me to completelyBen Harris2007-01-27
| | | | | | | | rewrite the Type 1 font support, and I'm sure the result is more complex than it needs to be, but it seems to work correctly, so I shouldn't complain. [originally from svn r7175]
* Overhaul of glyph-name handling in the paper backends. Before, we hadBen Harris2007-01-06
| | | | | | | | | | a separate dense array of glyph names for each font, and referenced glyphs by indicies into that array, which meant that the array had to be set up before we could generate any indices. Now we have an overall array of glyph names, and use the same glyph indicies for all fonts. Some arrays have had to turn into tree234s as a result. [originally from svn r7061]
* Tweak /OUT pdfmark generation -- PLRM suggests that constructing a largeBen Harris2006-12-12
| | | | | | | | executable array is likely to use lots of stack space, which might be bad on Level 1 interpreters, so use the same mechanism as for other pdfmarks and have a procedure that does nothing if pdfmark isn't defined. [originally from svn r6995]
* Rough-and-ready line wrapping for PostScript, to keep us below the DSC-mandatedBen Harris2006-12-12
| | | | | | | | 255 characters per line (excluding newline characters). In fact, it tries to keep us below 80 characters so as to make the PostScript more readable (and demonstrate that it's working). [originally from svn r6993]
* Explicitly set the title via pdfmark, since that allows us to putBen Harris2006-12-10
| | | | | | in Unicode, which we can't (reliably) in %%Title. [originally from svn r6987]
* Specify the /Border of /ANN pdfmarks correctly.Ben Harris2006-12-07
| | | | [originally from svn r6968]
* Tweak prologue so that it works correctly on interpreters that don't supportBen Harris2006-12-03
| | | | | | | pdfmark, specifically by having the dummy versions of "p", "x", and "u" pop their arguments rather than leaving them on the stack to cause trouble. [originally from svn r6956]
* Support for emitting outlines using pdfmark.Ben Harris2006-12-02
| | | | [originally from svn r6952]
* Adjust ps_string so that it escapes characters above 126. This makesBen Harris2006-12-02
| | | | | | Halibut's output 7-bit clean, which seems the best approach in PostScript. [originally from svn r6950]
* Rough pdfmark support. Links are implemented, but not outlines.Ben Harris2006-12-02
| | | | [originally from svn r6949]
* Add a procedure to our prologue to draw filled rectangles, and use it.Ben Harris2006-12-01
| | | | [originally from svn r6938]
* On Level 2 implementations, use setpagedevice to select the correct page size.Ben Harris2006-05-16
| | | | [originally from svn r6689]
* There's no need to reset the font every line if it hasn't changed. This savesBen Harris2006-05-14
| | | | | | a few K and a lot of calls to scalefont and setfont, which is probably good. [originally from svn r6686]
* Fairly ropey font-embedding support. In particular, the PDF output isBen Harris2006-05-14
| | | | | | | | technically incorrect, though it works perfectly well with xpdf. To do it properly requires actually parsing the unencrypted part of a Type 1 font, which will be a bit tedious in C. [originally from svn r6685]
* Initial support for adding fonts at run-time. Currently we only supportBen Harris2006-05-13
| | | | | | | | loading AFM files, we recognise them by name, and we can't embed fonts in the output (which is also invalid, though accepted by xpdf, in the PDF case). Oh, and there's no documentation. Still, it's a start. [originally from svn r6681]
* Don't bother overriding the metrics of PostScript fonts. If the metricsBen Harris2004-09-25
| | | | | | | we've got are wrong, things are going to look horrible either way, so we may as well apply minimal effort. [originally from svn r4580]
* If you're going to change the metrics of a font, it's necessary to leave spaceBen Harris2004-09-24
| | | | | | | in the new font dictionary for the Metrics entry. This is mentioned in the first edition of the Red Book, but not the second. [originally from svn r4577]
* Stupid bug: "t" was leaving the y-coordinate on the stack, which confusedBen Harris2004-09-21
| | | | | | | "restore". Quite how GhostScript managed not to give an error on this I don't know. [originally from svn r4565]
* Replace the hardcoded instances of "4096" and "4096.0" in the paper backendsBen Harris2004-09-21
| | | | | | | with a macro. halibut.ps and halibut.pdf are identical (modulo dates) over this change. [originally from svn r4564]
* Bracket each page in a save/restore pair. This is suggested by the Red Book,Ben Harris2004-09-21
| | | | | | | enforces page independence, avoids leaking VM on level 1 interpreters, and speeds things up to boot. [originally from svn r4561]
* Make the PostScript prologue look less like it was written by a C programmer.Ben Harris2004-09-20
| | | | | | | | In particular, use the operand stack to hold "x" and "y", and use a dictionary lookup to switch based on the type of "x". This also seems to give a slight speed increase. [originally from svn r4553]
* Two small tweaks to the prologue:Ben Harris2004-09-20
| | | | | | | | | * Use "/arraytype" etc rather than "[] type" etc. Should be faster and not fill local VM with empty arrays. * Use "bind" on the procedure, since it's conventional and will probably help speed too. [originally from svn r4552]
* Add lots of DSC comments, and change the DSC version to 3.0, which has beenBen Harris2004-09-20
| | | | | | | | | | | | | current since 1990. The only obvious change from this is that gv now displays the document title. There's a slight bug here at the moment in that the backend emits %%DocumentNeededResource and %%IncludeResource for each subfont of a PostScript font, even if that PostScript font has been requested already. This is wasteful but, as far as I can see, not actually disallowed, and is easier than de-duping the font list. [originally from svn r4551]
* Cut-and-paste error was preventing PS and PDF filename configSimon Tatham2004-07-17
| | | | | | options from being processed in some circumstances. [originally from svn r4329]
* Infrastructure changes for character set support. ustrtoa,Simon Tatham2004-04-20
| | | | | | | | | | | ustrfroma, utoa_dup and ufroma_dup now take a charset parameter, and also have a variety of subtly distinct forms. Also, when a \cfg directive is seen in the input file, the precise octet strings for each parameter are kept in their original form as well as being translated into Unicode, so that when they represent filenames they can be used verbatim. [originally from svn r4097]
* Compacted PS and PDF output files by removing redundant reiterationsSimon Tatham2004-04-16
| | | | | | | | of the same font and position designations. Reduced the size of the Halibut manual PDF to less than half what it started out as, and the PS one to more like a third of its original size. [originally from svn r4083]
* Put the document's version IDs into comments in the PS and PDFSimon Tatham2004-04-15
| | | | | | output files. [originally from svn r4079]
* Implemented PDF outlines.Simon Tatham2004-04-14
| | | | [originally from svn r4067]
* Implemented lines under chapter titles.Simon Tatham2004-04-13
| | | | [originally from svn r4065]
* Implement PDF link annotations: both internal hyperlinks within theSimon Tatham2004-04-13
| | | | | | | document, and references to external URLs for which acroread will start a web browser. [originally from svn r4060]
* Initial work on PS and PDF output. Because these two backends shareSimon Tatham2004-04-13
an enormous amount of preprocessing and differ only in their final output form, I've introduced a new type of layer called a `pre-backend' (bk_paper.c is one). This takes all the information passed to a normal backend and returns an arbitrary void *, which is cached by the front end and passed on to any backend(s) which state a desire for the output of that particular pre-backend. Thus, all the page layout is done only once, and the PS and PDF backends process the same data structures into two output files. Note that these backends are _very_ unfinished; all sorts of vital things such as section numbers, list markers, and title formatting are missing, the paragraph justification doesn't quite work, and advanced stuff like indexes and PDF interactive features haven't even been started. But this basic framework generates valid output files and is a good starting point, so I'm checking it in. [originally from svn r4058]