groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] How to embed PS char into groff input


From: Ted Harding
Subject: Re: [Groff] How to embed PS char into groff input
Date: Tue, 11 Dec 2001 16:30:40 -0000 (GMT)

On 11-Dec-01 Tadziu Hoffmann wrote:
> That's why I also mentioned that
> the whole procedure could equivalently be performed with a
> "ps: def" device control in the manuscript (or in a file of
> its own, sourced by the manuscript) instead of editing the
> prolog file.  Actually, this seems to be exactly the reason
> for implementing the "ps: def" in the first place.

Agreed. I've now implemented the method using "ps: def".
There is a complication, however. With "ps: def", and
also "ps: exec", you get an error message from grops if the PS
code exceeds 255 characters. Fortunately, with "ps: def /code/"
you can exploit the fact that (see "man grops"):

  "Long definitions can be split across several \X commands;
  all the /code/ arguments are simply joined together
  separated by newlines."

(I'm not sure whether this would apply to "ps:exec" /code/,
however, given that this puts a PS wrapper around /code/;
not that I've tried it ...).

Anyway, the following works as intended:

\X'ps: def /wedge { newpath % rgbR rgbG rgbB setrgbcolor '
\X'ps: def 0 0 moveto 1 0 translate 15 rotate 0 15 sin '
\X'ps: def translate 0 0 15 sin -90 90 arc closepath } def'
\X'ps: def /rose { gsave currentpoint translate '
\X'ps: def 2000 1.2 mul div dup scale 1.2 -1.2 translate '
\X'ps: def 0.02 setlinewidth 1 1 12 { 12 div setgray '
\X'ps: def gsave wedge gsave fill grestore 0 setgray stroke '
\X'ps: def grestore 30 rotate } for grestore } def '
.char \[rose] \X'ps: exec \\n[.ps] rose'\h'1m '
.LP
A Rose \[rose]\s+8 A Rose \[rose]\s0 A Rose \[rose]
.sp 1
\[rose]\*{\[rose]\*{\[rose]\*}\*}

Maybe the restriction on 255 characters needs removing?

Anyway, Tadziu, your method is preferable since all the
nasty detail is wrapped up once and for all in the PS
code, and the only usage-specific detail required from
the user is putting the "\\n[.ps]" in the right place
in the right place in the ".char" definition -- not too
much to ask if a user is already inventing his own glyphs!

Best wishes,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 11-Dec-01                                       Time: 16:30:40
------------------------------ XFMail ------------------------------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]