For Programmers: Free Programming Magazines  


Home > Archive > PostScript > March 2007 > gonzo tables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author gonzo tables
Graham

2007-02-28, 10:05 pm

I note that you can embed font changes inside gonzo.ps, but can you
also construct tables with similar escape sequences?

Don Lancaster

2007-03-04, 10:06 pm

Graham wrote:
> I note that you can embed font changes inside gonzo.ps, but can you
> also construct tables with similar escape sequences?
>



I am not sure of your question.

Nearly ANY PS proc can be activated from within a gonzo text string by
an embedded |/sneaky_stuff command. The command MUST be followed by a
space that gets swallowed by the command execution.

Here is an example that indents and restores their own and subsequent
lines...

(C:\\Documents and Settings\\don\\Desktop\\gonzo\\gonzo.ps) run % use
internal gonzo

/shiftin {xpos /xposhold exch store /xpos xpos 10 add store} def
/shiftout {/xpos xposhold store} def


50 150

(This is an example of
text that has been indented
|/shiftin so that the next line
and the line after it
|/shiftout are properly positioned) cl

========================================
======

Normally, you would put |/shiftin or |/shiftout on separate lines.
These could be combined with, say a |h half space, font changes,
a color background box, or whatever.

See any GuruGram .psl file for examples.





However, --> IF <-- the thingy you want done is unique to the INSIDE of
the current printlist, then you have to be sneaky to make sure your
thingy's execution is DEFERRED till the time the print list for that
line actually executes.

The reason for this is that on some justification modes, your
positioning will not be known until the actual printlist for that line
is executed.

Here is an example that makes one word blue...


============================

(C:\\Documents and Settings\\don\\Desktop\\gonzo\\gonzo.ps) run % use
internal gonzo


/blueon {mark /blue cvx 0.33 /setgray cvx] cvx
printlist exch 3 index exch put exch 1 add exch} def

/backtoblack {mark /black cvx] cvx
printlist exch 3 index exch put exch 1 add exch} def


50 50 (An example of one |/blueon blue|/blueoff character.)cl


showpage


==============================

Similar techniques can embed auto-repositioning URL's per the GuruGrams.

More gonzo at http://www.tinaja.com/gonzo01.asp
More detailed gonzo .psl examples at http://www.tinaja.com/gurgrm01.asp


--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com
DBW

2007-03-05, 7:13 pm

In article <45EB760F.50709@tinaja.com>, Don Lancaster <don@tinaja.com> wrote:

> Graham wrote:
>
> Here is an example that makes one word blue...
>
>
> (C:\\Documents and Settings\\don\\Desktop\\gonzo\\gonzo.ps) run % use
> internal gonzo
>
>
> /blueon {mark /blue cvx 0.33 /setgray cvx] cvx
> printlist exch 3 index exch put exch 1 add exch} def
>
> /backtoblack {mark /black cvx] cvx
> printlist exch 3 index exch put exch 1 add exch} def
>
>
> 50 50 (An example of one |/blueon blue|/blueoff character.)cl
>


The Tinydict can give you simple variable tabs, in-line font changes and
colours.

%!
% notice the space before using CS 'colour show'
1upA5 % open page format
10 rom % 10 pt roman
(Tab across) s
70 T (the page) s
140 T (in blue ) blue CS
200 T (red ) red CS
240 T (or italic.) 10 it n
10 rom % restore previous font style and size
close

For more complex boxed fields see the TinyTables:
www.cappella.demon.co.uk/resources/tabsdemo.ps

DB-W
Ross Presser

2007-03-05, 7:13 pm

On Mar 4, 8:44 pm, Don Lancaster <d...@tinaja.com> wrote:

> More gonzo athttp://www.tinaja.com/gonzo01.asp


gonzo01.asp is 404 ...

Don Lancaster

2007-03-05, 7:13 pm

DBW wrote:
> In article <45EB760F.50709@tinaja.com>, Don Lancaster <don@tinaja.com> wrote:
>
>
>
>
> The Tinydict can give you simple variable tabs, in-line font changes and
> colours.
>
> %!
> % notice the space before using CS 'colour show'
> 1upA5 % open page format
> 10 rom % 10 pt roman
> (Tab across) s
> 70 T (the page) s
> 140 T (in blue ) blue CS
> 200 T (red ) red CS
> 240 T (or italic.) 10 it n
> 10 rom % restore previous font style and size
> close
>
> For more complex boxed fields see the TinyTables:
> www.cappella.demon.co.uk/resources/tabsdemo.ps
>
> DB-W


These were ultra simple examples.
Gonzo allows incredibly complex embedded commands.

--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com
Don Lancaster

2007-03-05, 7:13 pm

Ross Presser wrote:
> On Mar 4, 8:44 pm, Don Lancaster <d...@tinaja.com> wrote:
>
>
>
>
> gonzo01.asp is 404 ...
>

Oops.
try http://www.tinaja.com/post01.asp#gonzo

--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com
Don Lancaster

2007-03-05, 7:13 pm

Ross Presser wrote:
> On Mar 4, 8:44 pm, Don Lancaster <d...@tinaja.com> wrote:
>
>
>
>
> gonzo01.asp is 404 ...
>


Oops.
try http://www.tinaja.com/post01.asp#gonzo


--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com
Ross Presser

2007-03-05, 7:13 pm

On Mar 5, 4:10 pm, Don Lancaster <d...@tinaja.com> wrote:
>
> Gonzo allows incredibly complex embedded commands.
>


Here's one I'm using to do underlining between |a and |b

% Underline start, stop, and draw
/ULStart { /ULMode true def /ULStartx xpos txtwide add roomleft sub
def /ULStarty ypos 1 sub def } def
/ULStop { ULDraw /ULMode false def} def
/ULDraw { ULStartx ULStarty xpos txtwide add roomleft sub 1 hrule }
def
/ULMode false def

% redefine startnextline to optionally draw underline on this line,
% then continue with startnextline1 which encompasses
% the old startnextline
/startnextline { ULMode { ULDraw } if startnextline1 } bind def
/startnextline1 {
...... % body of startnextline omitted -- look at the original gonzo.ps
} bind def

% macros
/amacro { ULStart } def
/bmacro { ULMode { ULStop } if } def


% Example:

(This |aword|b is underlined.) stringgonzo

Don Lancaster

2007-03-05, 7:13 pm

Ross Presser wrote:
> On Mar 5, 4:10 pm, Don Lancaster <d...@tinaja.com> wrote:
>
>
>
> Here's one I'm using to do underlining between |a and |b
>
> % Underline start, stop, and draw
> /ULStart { /ULMode true def /ULStartx xpos txtwide add roomleft sub
> def /ULStarty ypos 1 sub def } def
> /ULStop { ULDraw /ULMode false def} def
> /ULDraw { ULStartx ULStarty xpos txtwide add roomleft sub 1 hrule }
> def
> /ULMode false def
>
> % redefine startnextline to optionally draw underline on this line,
> % then continue with startnextline1 which encompasses
> % the old startnextline
> /startnextline { ULMode { ULDraw } if startnextline1 } bind def
> /startnextline1 {
> ..... % body of startnextline omitted -- look at the original gonzo.ps
> } bind def
>
> % macros
> /amacro { ULStart } def
> /bmacro { ULMode { ULStop } if } def
>
>
> % Example:
>
> (This |aword|b is underlined.) stringgonzo
>


Underlining should be tolerated in the second grade, discouraged in the
third, and severely punished in the fourth.

Fortunately, the problem takes care of itself because compulsive
underliners eventually grow enough hair on the palms of their hands that
they can no longer type.

Your code would not work in the fill justify mode.
You have to defer the start and end of the underline till the printlist
is actually executed. Per the above example.

While underlining used to work at one time, color changes or putting an
entire color box behind the emphasis is much better.

See the GuruGram .psl's for many examples.

You can also use the |o overstrike command to underline directly.

50 50 (This w|o_o|o_r|o_d|o_ is underlined.)cl



--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com
Ross Presser

2007-03-06, 7:04 pm

On Mar 5, 6:36 pm, Don Lancaster <d...@tinaja.com> wrote:

> Fortunately, the problem takes care of itself because compulsive
> underliners eventually grow enough hair on the palms of their hands that
> they can no longer type.


And compulsive pedants eventually end up in a position where they can
pontificate and write libraries instead of yielding to client wishes?

> Your code would not work in the fill justify mode.
> You have to defer the start and end of the underline till the printlist
> is actually executed. Per the above example.


That doesn't ring quite true to me .. I do use fill justify (right-
ragged edges, though). I'll have to see if it ever actually fails in
my application.

> While underlining used to work at one time, color changes or putting an
> entire color box behind the emphasis is much better.


When I have to satisfy a client who wants underlining, I provide
underlining. Especially when the output is invoices to be printed on
a highlight color printer (black + red ink only) and red is being used
elsewhere to the extent that it would no longer stand out.

> You can also use the |o overstrike command to underline directly.
>
> 50 50 (This w|o_o|o_r|o_d|o_ is underlined.)cl


That'd be fine if the underlined parts weren't variable text, and if I
was using a font where underscore characters actually join up.

I am aware of the history of underlining -- that it is a holdover from
actually writing text with a pen, as opposed to setting it with
movable type or filling a raster buffer. Nevertheless, people are
used to underlining, understand underlining, expect underlining. The
fact that Postscript's designers disliked underlining and made it
harder to do than other means of emphasis does not change the
attitudes of clients.

Don Lancaster

2007-03-06, 7:04 pm

Ross Presser wrote:
> On Mar 5, 6:36 pm, Don Lancaster <d...@tinaja.com> wrote:
>
>
>
>
> And compulsive pedants eventually end up in a position where they can
> pontificate and write libraries instead of yielding to client wishes?
>
>
>
>
> That doesn't ring quite true to me .. I do use fill justify (right-
> ragged edges, though). I'll have to see if it ever actually fails in
> my application.
>
>
>
>
> When I have to satisfy a client who wants underlining, I provide
> underlining. Especially when the output is invoices to be printed on
> a highlight color printer (black + red ink only) and red is being used
> elsewhere to the extent that it would no longer stand out.
>
>
>
>
> That'd be fine if the underlined parts weren't variable text, and if I
> was using a font where underscore characters actually join up.
>
> I am aware of the history of underlining -- that it is a holdover from
> actually writing text with a pen, as opposed to setting it with
> movable type or filling a raster buffer. Nevertheless, people are
> used to underlining, understand underlining, expect underlining. The
> fact that Postscript's designers disliked underlining and made it
> harder to do than other means of emphasis does not change the
> attitudes of clients.
>


Try giving the client a lollypop instead.
Or find a real client instead.


--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com
DBW

2007-03-06, 7:04 pm

In article <555ur4F23hpqiU3@mid.individual.net>, Don Lancaster
<don@tinaja.com> wrote:

> Ross Presser wrote:
<snip>[color=darkred]
>
> Try giving the client a lollypop instead.
> Or find a real client instead.


> DBW wrote:
<snip>
[color=darkred]
> Don Lancaster <d...@tinaja.com> wrote:
> These were ultra simple examples.
> Gonzo allows incredibly complex embedded commands.


The Tinydict is intended to be 'simple'. Like this:
(You may need underlining for totals ) s ($205.80) ul

It was Don's articles on PostScript in BYTE magazine in 1990 that
engendered my own enthusiasm and lack of hair.
DB-W
Graham

2007-03-06, 10:04 pm

On Mar 5, 2:44 pm, Don Lancaster <d...@tinaja.com> wrote:
> Graham wrote:
>
> I am not sure of your question.


Don and David,

The situation I face is processing a block of text that a user has
written in a text box. In other words, the user writes a page of text
or so, and this is then passed to the final postscript file - in this
case further processed by gonzo.

In this particular instance, physicians are writing patient
consultation/encounter documentation.

I have used David's table routines to generate tables, but in the
example above, the routine assumes that the above is all text.

So, I think the only ways I can think to do this to allow the user to
create simple tables within their text, is to look for a sneaky
command implementation as you describe, or add some other markup like
html tables, and then pre-process the text before forwarding it to
gonzo, or tinydict, to further process.

Is that clear as mud??

DBW

2007-03-07, 8:25 am

In article <1173232561.594924.56760@t69g2000cwt.googlegroups.com>,
"Graham" <compkarori@gmail.com> wrote:

> On Mar 5, 2:44 pm, Don Lancaster <d...@tinaja.com> wrote:
>
> Don and David,
>
> The situation I face is processing a block of text that a user has
> written in a text box. In other words, the user writes a page of text
> or so, and this is then passed to the final postscript file - in this
> case further processed by gonzo.
>
> In this particular instance, physicians are writing patient
> consultation/encounter documentation.
>
> I have used David's table routines to generate tables, but in the
> example above, the routine assumes that the above is all text.
>
> So, I think the only ways I can think to do this to allow the user to
> create simple tables within their text, is to look for a sneaky
> command implementation as you describe, or add some other markup like
> html tables, and then pre-process the text before forwarding it to
> gonzo, or tinydict, to further process.
>
> Is that clear as mud??


You could use a text editor like BBEdit or NoteTab that can automatically
prefix- and suffix the PostScript delimeters ( ) and mark-up codes.

Alternatively, if the input text has to be typeset in specific fields then
the providers of the original copy could number each item with a suitable
marker such as * to avoid confusion with figures in the text.

Search and Replace can then prefix field widths or any font changes:
E.g. Search: 1*
Replace: 100 FW 10 bol (

2* could also close the previous text and provide a return for on-screen
reading:
Search: 2*
Replace: ) \r 150 FW 10 it (
DB-W
DBW

2007-03-07, 8:25 am

In article <byram-0703071200350001@10.0.0.5>, byram@cappella.demon.co.uk
(DBW) wrote:

> You could use a text editor like BBEdit or NoteTab that can automatically
> prefix- and suffix the PostScript delimeters ( ) and mark-up codes.
>
> Alternatively, if the input text has to be typeset in specific fields then
> the providers of the original copy could number each item with a suitable
> marker such as * to avoid confusion with figures in the text.
>
> Search and Replace can then prefix field widths or any font changes:
> E.g. Search: 1*
> Replace: 100 FW 10 bol (
>
> 2* could also close the previous text and provide a return for on-screen
> reading:
> Search: 2*
> Replace: ) \r 150 FW 10 it (
> DB-W



Correction
You will of course need a closing markup in the Replace:
Such as 'lf' for left field or 'lb' for left boxed, etc.

Search: 2*
Replace: ) lf \r 150 FW 10 it (

or for normal running text

Replace: space) J \r (

Remember the space before the closing ) when followed by the caps
justification codes P, M, J, CS, S, or the last word disappears into
digital limbo.

The \r return has no effect on the printed output but makes the script
easier to read on-screen.

DB-W
Ross Presser

2007-03-07, 7:07 pm

On Mar 6, 2:47 pm, Don Lancaster <d...@tinaja.com> wrote:

>
> Try giving the client a lollypop instead.
> Or find a real client instead.


Do you have the same attitude towards strike-through, too? Lawyers
depend on strike-through to an immense extent, and from Postscript's
POV it's just an underline at a higher baseline offset.

Ian Wilson

2007-03-08, 8:08 am

Ross Presser wrote:
> On Mar 6, 2:47 pm, Don Lancaster <d...@tinaja.com> wrote:
>
>
>
>
> Do you have the same attitude towards strike-through, too? Lawyers
> depend on strike-through to an immense extent, and from Postscript's
> POV it's just an underline at a higher baseline offset.
>


It seems to me that typographers' dislike of underlining is
well-founded. So far as I know, underlines came into widespread use
because early mechanical typewriters were unable to produce italics,
bold or other means of emphasising text. Underlining was a poor-man's
substitute for traditional forms of emphasis.

According to Wikipedia, underlines were used as markup in manuscripts to
be typeset, single underline indicated the final text should be italic.

I believe underlines and strikethrough would not normally have been
expected to be present in the final form of a document.
Ross Presser

2007-03-08, 7:04 pm

On Mar 8, 5:50 am, Ian Wilson <scoblo...@infotop.co.uk> wrote:

> It seems to me that typographers' dislike of underlining is
> well-founded. So far as I know, underlines came into widespread use
> because early mechanical typewriters were unable to produce italics,
> bold or other means of emphasising text.


Nonsense. Underlining is older than movable type. It's the most
natural way for a person with a pen to emphasize text in a handwritten
manuscript.

Typographers developed a dislike of underlining because it introduces
difficulties into setting movable type. They also obscure the
descenders in typeset glyphs. These are reasonable things to want to
avoid when you're using metal, movable type. When you're drawing
vectors in a frame they are less reasonable.

> Underlining was a poor-man's
> substitute for traditional forms of emphasis.


If by "poor man" you mean "somebody who uses a pen", then I suppose
you're right. And as I stated above "traditional" is wildly misleading
because underlining is much older than movable type.

> According to Wikipedia, underlines were used as markup in manuscripts to
> be typeset, single underline indicated the final text should be italic.


True but not the whole story. Typesetters using movable type refused
to use underlining in order to save themselves trouble, and italics
were their proposal for emphasis; the editors and typesetters reached
a compromise which today is treated as Holy Writ.

> I believe underlines and strikethrough would not normally have been
> expected to be present in the final form of a document.


Visit a law library sometime. Lawyers are even more traditional and
unwilling to compromise than typesetters, so they still use
strikethrough. Strikethrough represents text that has been replaced
or removed, yet shows the entire history of the document without
having to compare separate pieces of paper. The "final form" of the
document *includes* the strikethrough because they want to see it that
way.

Besides which, the "final form of the document" is not the only form
that will ever be output by the computer; intermediate drafts are
invaluable to the editing process. You would deny editors the ability
to print strikethrough or underlines at all.

Graham

2007-03-08, 7:04 pm

I am reading these replies through the google groups interface, and
it amuses me a little to see that the tree on the left has all the
authors' names underlined :)

Fortunately, none of the contributors to this off topic thread has a
descender in their screen names.

Graham

2007-03-08, 7:04 pm

On Mar 8, 1:31 am, b...@cappella.demon.co.uk (DBW) wrote:[color=darkred]
> In article <byram-0703071200350...@10.0.0.5>, b...@cappella.demon.co.uk
>
>
>
> (DBW) wrote:

The trick I am trying to achieve is to allow the maximum flexibility
without imposing the requirement for users, who were brought up using
Gui word processors, to learn complicated markup. I started off by
using LaTeX, but abandoned that looking for something less
restrictive.

You've given me some more ideas I can try.

Ross Presser

2007-03-08, 7:04 pm

On Mar 8, 2:28 pm, "Graham" <compkar...@gmail.com> wrote:
> On Mar 8, 1:31 am, b...@cappella.demon.co.uk (DBW) wrote:
>
>
>
> The trick I am trying to achieve is to allow the maximum flexibility
> without imposing the requirement for users, who were brought up using
> Gui word processors, to learn complicated markup. I started off by
> using LaTeX, but abandoned that looking for something less
> restrictive.
>
> You've given me some more ideas I can try.


If you're going the way of introducing some simple syntax to the user
for table design, that they use in the input textbox, which your
application then uses to generate postscript for the Tinydict, might I
suggest something like this:


----- BEGIN TABLE
| row 1 cell text | cell text | cell text |
-----
| row 2 cell text | cell text | cell text |
----- END TABLE

Easier on the eyes than HTML, easy enough for your application code to
interpret, and easy enough to translate to Tinydict table routines.

Ross Presser

2007-03-08, 7:04 pm

On Mar 8, 2:22 pm, "Graham" <compkar...@gmail.com> wrote:
> I am reading these replies through the google groups interface, and
> it amuses me a little to see that the tree on the left has all the
> authors' names underlined :)
>
> Fortunately, none of the contributors to this off topic thread has a
> descender in their screen names.


Yes, but notice the y in the underlined "Sort by date" right above the
topic tree? :-)

DBW

2007-03-09, 4:14 am

In article <1173382112.756193.103530@s48g2000cws.googlegroups.com>,
"Graham" <compkarori@gmail.com> wrote:

> On Mar 8, 1:31 am, b...@cappella.demon.co.uk (DBW) wrote:
>
> The trick I am trying to achieve is to allow the maximum flexibility
> without imposing the requirement for users, who were brought up using
> Gui word processors, to learn complicated markup. I started off by
> using LaTeX, but abandoned that looking for something less
> restrictive.
>
> You've given me some more ideas I can try.


To avoid any setting errors, your contributors need not mark-up but suffix
a suitably obvious macro instruction. Whoever sets the text does the
necessary search and replace. A suffix is preferable for PS markup as the
delimiters and codes are inserted correctly.

Some copy:
My Booklist CH* % centered header = ) c
Author1* Title2* Price3*

Table macros searched and replaced with varied field widths
Replace an n*: e.g. 1* = ) cb ( % text centered in box.
(Author) cb FW 120 (Title) cb 25 FW (Price) cb nl % newline for last one

Another point to remember when dealing with raw text is that PCs and Unix
systems 'print' an unwanted space into a line of text for every on-screen
line feed or return.
This can be cured by the PostScript 'soft' return of space - backslash -
return at the end of each line of on-screen text, thusly:

Sed ut perspiciatis unde omnis iste \
natus error sit voluptatem accusantium \
doloremque laudantium. \** % an end-of-text macro

The backslashes can be inserted by Search: \lf
Replace: space\ \r
Some search dialogs require a backslash before a backslash \\

Anyone with a Mac can insert delimiters and justification codes
automatically by using the BBEdit or TexEdit Pre- and Suffix tools and
unwrapping the text so that each paragraph disappears in a single line
into the sunset on the right hand side of the monitor.

Using BBEdit on a MacMini to suffix the Tinydict full justification markup
'space) J' and prefix the '(', I typeset a Guttenberg text of 192,000
words with full justification, running headers, and automatic hyphenation
in 2 minutes. The resulting PS file then distilled into a book of 500
pages in 3 minutes, ready for PDF proof reading and the placing of newpage
breaks for chapter headers.
Of course, adjusting for widows n'orphans could take four ws.

DB-W
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com