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

World: r3wp

[Postscript] Emitting Postscript from REBOL

Henrik
24-Feb-2008
[1482x2]
go ahead :-)
BTW: Does it work for you in preview.app?
Geomol
24-Feb-2008
[1484]
Yes, it works in preview now. :-)
Henrik
24-Feb-2008
[1485x2]
so for the other bug: I mentioned earlier that some printers I tried 
it on directly, will cause the printer to pause after the first page 
is printed. Then I need to press paper feed or reset the printer 
to get the rest out. Using Printfile for Windows solves that, but 
that program is really old and I don't want to rely on it in the 
future if my project is moved to Linux clients. I suspect there is 
just one char missing at the end of the PS file, but I don't truly 
know what causes it.
an important detail: I don't think it's single print jobs of multiple 
pages that cause it, but rather multiple single page jobs.
Geomol
24-Feb-2008
[1487x2]
To do anything about it, we need to be able to reproduce that error, 
and see if we can figure out, that might solve it. A way to test 
different things is to edit the ps-files by hand.
that = what
Henrik
24-Feb-2008
[1489x4]
what I do to cause the error is make a ps file with postscript.r 
and then feed it directly to the printer. In windows I print directly 
to LPT1: to produce it. Under Linux I print it via LPR.
I've seen the bug in two separate HP laser printers
no, sorry, under Linux I also print to the device directly. LPR was 
when I used PDF for printing rather than PS.
a simple check: does a PS example from the internet end the same 
way as a postscript.r generated file?
Geomol
24-Feb-2008
[1493]
Output from TextEdit printed to a PS file has this in the end:

%%Trailer
%%Pages: 1
%%EOF
^D


The last char (ctrl-D) is hex 04. I think, the comment lines are 
according to "PostScript Language Document Structuring Conventions 
Specification". You can find this document on the net at Adobe. So 
there is a difference in how %%Pages comments are handled. And postscript.r 
doesn't put hex 04 in the end. You could try some of these changes, 
when you have the problem.
Henrik
24-Feb-2008
[1494]
I'll give it a shot when I get access to the testing equipment.
Geomol
26-Feb-2008
[1495x2]
Updated the documentation:
http://home.tiscali.dk/john.niclasen/postscript/postscript.html
Added describtion of comment.
Has anyone tried the transformations? There might be an unwanted 
restriction in the implementation. I can't get transformations to 
work for a whole page, only for one path at a time.
Henrik
26-Feb-2008
[1497]
I've only tried transformations for single paths, sorry.
Geomol
26-Feb-2008
[1498]
Do you use right-aligned text?
Henrik
26-Feb-2008
[1499]
it has worked fine in the past, I believe
Geomol
26-Feb-2008
[1500]
Yes, but it only worked with integer! text-size. I've added decimal! 
option, and this seems to work too. (sub-unit precision)
I have a new version ready soon.
Henrik
26-Feb-2008
[1501]
cool :-)
Geomol
26-Feb-2008
[1502]
I needed the decimal! for text size in alignment, because postscript 
work with 72 dot pr. inch by default. Putting text on the page often 
need the text to be with sub-unit precision. It was possible to put 
the text with sub-unit before, but now also alignment can be with 
sub-unit precision.
Henrik
19-Apr-2008
[1503x3]
anyone been working on a postscript table generator for the dialet?
dialect
Geomol. have you been looking at vertically centered text? It could 
be added as a y parameter to 'text, where we already use an x parameter 
for the string box size.
Geomol
19-Apr-2008
[1506]
No, I don't think, I've looked at that yet. I might tomorrow.
Reichart
19-Apr-2008
[1507]
That is the big problem, basically, that as in going across pages 
(or being wide).
Henrik
19-Apr-2008
[1508x2]
I think I have a crude way to do it for one line.
need it for table cells
Reichart
19-Apr-2008
[1510]
I'm working on displaying Qwikis (Wikis) on Cell phones.


It is a connected problem, viewing something intended for one medium 
on another.  

My basic plan is:


- Images - make a thumbnail, then let them click on it to see a larger 
or a list of sizes of their choice


- Tables - Show the name of the table, and then a bias, column or 
row, and offer a search.  Then drill down.


When printing big tables to paper you have to decide what to do if 
the table is simply too big for a single piece of paper.

Put the table at the end on multiple pages?

Put a small version of the table (perhaps unreadable), and say "See 
table on Exhibit X"?
Put the table on multiple pages inline?

Convert the table to something else, for example more like a query 
result, where each row is a chunk of data in a new format?
Henrik
19-Apr-2008
[1511]
looks like getting something so simple as the font height is rather 
difficult in postscript
Graham
19-Apr-2008
[1512]
huh?
Henrik
19-Apr-2008
[1513]
Geomol, I have the structure change needed for text to support the 
font height, so the vertical centering can be made, but I just can't 
find the postscript commands necessary to obtain the font height.
Graham
19-Apr-2008
[1514x2]
you define the font height when you set the font.
and there are postscript commands for getting the size of the text
Henrik
19-Apr-2008
[1516]
the width of the text yes, not the height. and I may not know the 
font at rendering time as that may be set in a completely different 
part of the program.
Graham
19-Apr-2008
[1517x3]
not sure about that .. but you can set a postscript variable to hold 
the latest fontsize and reference that
/fontsize (size) def
I seem to remember justification routines get the word size, drop 
the height value and just work on the width
Henrik
19-Apr-2008
[1520]
stringwidth returns the width and some form of Y value that is not 
the height, but something else.
Graham
19-Apr-2008
[1521x2]
it's the offset from the baseline
The ``charpath'' operator extracts the graphic shapes of its string 
operand and appends them to the current path in the graphic state. 
These shapes can then be processed by other PostScript operators. 
To get the actual size of the area touched by a character a simple 
approach is

	gsave
	newpath
	0 0 moveto
	(X) false charpath flattenpath pathbbox
	grestore


This code places four numbers on the stack, representing the coordinates 
of the lower left and upper right corners of the bounding box enclosing 
the character ``X'' rendered with the current point at (0,0). Leaving 
the flattenpath out will cause it to be less accurate, but it will 
take up less memory and be faster.
Henrik
19-Apr-2008
[1523x3]
how do I call it again, with /fontsize or fontsize?
tried that one, couldn't get it to work.
though not in that form
Graham
19-Apr-2008
[1526]
faq: http://www.postscript.org/FAQs/language/node67.html
Henrik
19-Apr-2008
[1527]
nope, that doesn't work either
Graham
19-Apr-2008
[1528]
what do you mean it doesn't work?
Henrik
19-Apr-2008
[1529x3]
I get a postscript error.
Got the font size to work, but it doesn't take the baseline into 
account.
time for bed... Geomol can take over in the morning. :-)