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 13:16:10 -0000 (GMT)

On 11-Dec-01 Tadziu Hoffmann wrote:
> 
>> 1. Put the PS code into a file "rose2.ps". NB that this code
>> MUST include a suitable "%%BoundingBox:" comment line.
> 
> Actually, the file does NOT need the BoundingBox comment,
> since it isn't evaluated by anybody.  However, the numbers
> in the "import" device control have to be correct.

Fair enough (though when it comes to getting those numbers
right, it is useful to have the %%BoundingBox to refer to).

> Anyhow, here's a different version that does the same thing
> (but is perhaps easier to understand):
> 
> Add the following rose definition to the grops dictionary in
> the PostScript prolog file ($GROFF_FONT_PATH/devps/prologue):
> (You can use a "ps: def" device control in your manuscript
> instead.)

The reason I wouldn't do this is that it involves editing
the "prologue" file for any such character, whereas if
you need to use PostScript-defined characters of this kind
then you may want to use several different characters
in the same or in different documents. I much prefer to
leave the "prologue" file strictly untouched, except for
any changes which one may wish to apply to all documents.

Therefore I personally recommend the kind of approach
I suggested, where the character has an independent
"stand-alone" definition which can be incorporated
"in-line" when it is needed.

(Also, this kind of thing may not be needed for ever,
and unless you remember to re-edit the "prologue" file
to remove it when no longer needed, you will end up
with something which I try to resist as much as possible,
namely system files which resemble a drawer-full of
underwear and unmatched socks ... ).

The method I illustrated (involving a complex use of \n[.ps]
etc) was developed when I first encountered the need, and
for this example some of the numerical features (like the
\h and \v motions) were hand-tuned.

It may well be possible to work out how to incorporate
your variant of the PS code (which does its own scaling)
into an in-line ".char" definition, though for the
moment it is not obvious to me how to do it (but see below).

> [...]
> 
> This defines a PostScript procedure "rose" (taking one argument,
> the desired size of the rose) which we can have executed by a
> "ps: exec" device control:
> 
> .char \[rose] \X'ps: exec \\n[.ps] rose'\h'1m'

I am wondering if a variant:

  .char \[rose] \X'ps: exec \\n[.ps] \\*[rose]'\h'1m'

could be conveniently developed, where \*[rose] is
a string containing all the PostScript code similar
to in your version. I haven't had time to try this yet.

> This character definition tells PostScript to draw the rose in a
> size proportional to the current troff font size (any additional
> scaling is done by PostScript within the rose procedure) and also
> tells troff the width of the character (in this case, 1 em).
> [...]
> (By the way: the \*{, \*} definitions in the groff-1.17.1 version
> of gs.tmac do not allow nesting, because the size is restored
> with \s0 which can only go back one size change.)

Sure, but for this illustration it doesn't matter; the point
was to demonstrate that this definition behaves like any
other character (e.g. "A"), rescaling as one would expect.

Thanks for the thoughts,
Ted.

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

reply via email to

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