[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Turn text upside down
From: |
Tadziu Hoffmann |
Subject: |
Re: [Groff] Turn text upside down |
Date: |
Wed, 25 Jan 2012 22:23:37 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
> how can I turn text upside down, will say:
> rotate by 180 degrees?
As far as I know this can only be done with appropriate
device code. And of course it depends on how much text you
want upside down. Here is a little example in Postscript
that rotates a short text fragment within a line of text
(the fragment must fit on one line). If you need larger
blocks I guess it would be better to have a start macro
(which translates and rotates the coordinate system) and an
end macro (which restores the original coordinate system)
instead of a single macro.
.\"
.\" --------------------------------------------------------------------
.de UD
.nr WD \w'\\$1'
\Z'\h'\\n(WDu'\
\X'ps: exec gsave currentpoint 2 copy \\n[.ps] u -.45 mul add \
translate 180 rotate neg exch neg exch translate'\
\\$1\
\X'ps: exec grestore''\h'\\n(WDu'\\$2
..
.\" --------------------------------------------------------------------
.ll 15c
.po 3c
.sp 3c
.ps 12
.vs 14
Hello,
.UD world !
This particular example saves the old coordinate system and
then rotates the coordinate system around the current point:
gsave
currentpoint 2 copy
translate
180 rotate
neg exch neg exch translate
and later restores the saved coordinate system:
grestore
the rest is just trickery to keep the upside-down word in line.
If you want a whole page upside down, it would of course be
easier to rotate 180 degrees around one corner and then move
the coordinate origin to the opposite corner.