groff
[Top][All Lists]
Advanced

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

[Groff] Fractional point-sizes in groff with PS


From: Ted Harding
Subject: [Groff] Fractional point-sizes in groff with PS
Date: Tue, 04 Dec 2012 23:05:52 -0000 (GMT)

Greetings All!
I'm posting this because it does not seem to be explicitly
documented in groffinfo (though it may be deducible from what
is in there).

Namely, it is possible to explcitly set fractional point
sizes in groff, which will be so realised in PS output.

Simple example (filename junk0.tr):

\s[11]This is in 11-point.\s0
.br
\s[9.767]This is in 9.767-point.\s0

Output (groffout) of cat junk0.tr | troff -Tps | less :

x T ps
x res 72000 1 1
x init C
p1
x font 5 TR
f5
s11000
V12000
H72000
md
DFd
tThis
wh2750
tis
wh2750
tin
wh2750
t11-point.
n12000 0
s9767
V24000
H72000
tThis
wh2442
tis
wh2442
tin
wh2442
t9.767-point.
n12000 0
x trailer
V792000
x stop

You can see that "s11000" sets the point size to 11000u,
i.e. 11 points; while "s9767" sets it to 9767u (9.767 points).

This duly carries through to the PS output. The relevant lines
from the resulting PS file are:

%%EndPageSetup
/F0 11/address@hidden SF
<5468697320697320696e2031312d706f696e742e>72 84 Q
/F1 9.767/address@hidden SF
<5468697320697320696e20392e3736372d706f696e742e>72 96 Q 0 Cg EP
%%Trailer
end
%%EOF

where "/F0 11/address@hidden SF" sets the point-size to 11 points, and
"/F1 9.767/address@hidden SF" sets it to 9.767 points.

That's fine for explicitly chosen fractional point-sizes.
Groff (like the original troff) unfortunately does not do floating-point
arithmetic, so point-size conversions like (0.707=sqrt(2) to 3dp):

  \s[\n[.s]*0.707]

won't work! (When I need to, I use 'pic' for floating-point,
making use of its "command" command to feed numerical results
to troff -- but this involves re-writing the ".PS" macro so
that it does not have a direct effect on the layout of the
final document, i.e. acts "invisibly").

This may be of interest to some, and I would also welcome comments
from anyone who has more insight into how to do this sort of thing!

Best wishes to all,
Ted.

-------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Date: 04-Dec-2012  Time: 23:05:48
This message was sent by XFMail
-------------------------------------------------


reply via email to

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