groff
[Top][All Lists]
Advanced

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

Re: [Groff] Re: YaDCM (Yet another Drop Capital Macro)


From: Gaius Mulley
Subject: Re: [Groff] Re: YaDCM (Yet another Drop Capital Macro)
Date: 18 Mar 2005 18:33:03 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Werner LEMBERG <address@hidden> writes:

> > However, I see a couple of problems:- [...]
> 
> Gaius, in case you've fixed those issues please repost your macro with
> all patches applied.

Hi Werner,

The first of the two problems has now been fixed (thanks to Keith)
The second problem is still outstanding, still here is the latest
macro and example which shows the problem..

.\"
.\"  DROPCAP - macro set provides a reasonably comprehensive macro
.\"            to achieve a drop capital.
.\"
.\"            What is different from other drop capital implementations
.\"            is that this allows a user to add in adjustments on
.\"            a per line basis all the way down the drop capital.
.\"            So for example a user may pull/push text in and out of a
.\"            capital `I' if required.
.\"            The first argument is the first whole word. This is
.\"            automatically chopped into a letter and the subsequent
.\"            letters are capitalized.
.\"
.\"            This macro was written
.\"            by Gaius Mulley - _but_ it was based on a number of
.\"            postings from the address@hidden mailing list.
.\"            Note it also uses the .uppercase macro written by
.\"            Werner Lemberg.
.\"            From memory other postings which gave ideas to this
.\"            macro were from: Werner Lemberg, Ted Harding,
.\"            Ralph Corderoy (and others).
.\"
.\"            Please feel free to improve and modify the macro or
.\"            simply take ideas and incorporate them elsewhere.
.\"
.\"  Usage:
.
.\"  dropcap - WORD LINES COLOUR FONT FAMILY ADJUSTMENT { ADJUSTMENT }
.
.\"  Example:
.
.\"  .dropcap When 4 darkblue R T 0 -1n
.\"  produces a rather nice effect as we can see the
.\"  subsequent lines indented by -1n each line down
.\"  the drop capital. It is possible to append more
.\"  parameters to this macro, each parameter indicates
.\"  the relative indentation for the next line.
.\"  Therefore it is possible to make text pull in
.\"  and out of a drop capital I.
.
.\"
.\" .uppercase in out
.\"
.\"   Convert the contents of string with name `in' to uppercase
.\"   and return the result in a string with name `out'.
.\"
.\"   Note that this macro by default only translates the characters a-z;
.\"   if you need other characters, define them in the strings
.\"   `uppercase-set' and `uppercase-reset'.  Both are used with the `.tr'
.\"   request; the former to set the mapping, the latter to reset it.
.\"
.de uppercase
.  rm \\$2
.  tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
.  tr \\*[uppercase-set]
.  di uppercase-div
.    nop \\*[\\$1]
.    br
.  di
.  asciify uppercase-div
.  chop uppercase-div
.  tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
.  tr \\*[uppercase-reset]
.  ds \\$2 \\*[uppercase-div]\"
..
.
.ds uppercase-set ä\[:A]
.ds uppercase-reset ä\[:a]
.
.de dc::next-line
.  ie \\n[dc::linesm1]>0 \{\
'     in +\\n[dc::adjustarray\\n[dc::linesm1]]u
.     mk dc::droppos2
.     wh \\n[dc::droppos2]u+1v dc::next-line
.     nr dc::linesm1 \\n[dc::linesm1]-1
.  \}
.  el \{\
'    in \\n[dc::orig-indent]u
.  \}
..
.\"
.\"  dropcap - WORD LINES COLOUR FONT FAMILY ADJUSTMENT { ADJUSTMENT }
.\"
.de dropcap
.  rm dc::lines dc::linesm1
.  ds dc::word \\$1
.  ds dc::letter \\$1
.  substring dc::letter 0 0
.  ds dc::originalremainder \\*[dc::word]
.  length dc::word-len \\*[dc::word]
.  ie \\n[dc::word-len]>1 \{\
.     substring dc::originalremainder -1 1
.     uppercase dc::originalremainder dc::remainderofword
.  \}
.  el \{\
.     ds dc::originalremainder "
.     ds dc::remainderofword   "
.     ds dc::letter \\$1
.  \}
.  nr dc::lines \\$2
.  ds dc::dropcolor \\$3
.  ne \\n[dc::lines]
.  nr dc::dummy \\w'\\*[dc::letter]'u
.  nr dc::charheight \\n[rst]
.  nr dc::linesm1 \\n[dc::lines]-1
.  nr dc::linesindex \\n[dc::linesm1]
.  ds dc::font \\$4
.  ds dc::family \\$5
.  nr dc::initadjust (u;\\$6)
.  nr dc::adjustment (u;\\$7)
.  nr dc::lastadjust (u;\\$7)
.  shift 6
.  while \\n[dc::linesindex]>0 \{\
.     nr dc::adjustarray\\n[dc::linesindex] 0
.     ie \\n[.$]>0 \{\
.        nr dc::lastadjust (u;\\$1)
.        nr dc::adjustarray\\n[dc::linesindex] \\n[dc::lastadjust]
.        shift
.     \}
.     el .nr dc::adjustarray\\n[dc::linesindex] 0+\\n[dc::lastadjust]
.     nr dc::linesindex \\n[dc::linesindex]-1
.  \}
.  nr dc::inside-drop 1
.  nr dc::dcht 
((\\n[.v]*\\n[dc::linesm1])+\\n[dc::charheight])*(\\n[.ps])/\\n[rst]
.  char \[dc::dcap] \\s'\\n[dc::dcht]u'\\F[\\*[dc::family]]\
\\f[\\*[dc::font]]\\*[dc::letter]\\fP\\F[]\\s0
.  nr dc::dummy \\w'\[dc::dcap]'u
.  nr dc::dropheight \\n[rst]
.  nr dc::orig-indent \\n[.i]
.  nop \\v'(\\n[dc::dropheight]u-\\n[dc::charheight]u)'\c
.  nop \\m[\\*[dc::dropcolor]]\\[dc::dcap]\\m[]\h'\\n[dc::initadjust]u'\c
.  nop \\v'-\\n[dc::dropheight]u+\\n[dc::charheight]u'\c
.  nop \\v'\\n[dc::linesm1]'\c
.  mk dc::droppos
.  wh \\n[dc::droppos]u+1v dc::next-line
.  nop \\v'-\\n[dc::linesm1]'\c
'  in +\w'\\[dc::dcap]'u+\\n[dc::adjustment]u+\\n[dc::initadjust]u
.  nr dc::linesm1 \\n[dc::linesm1]-1
.  if \\n[dc::word-len]>1 .nop \\*[dc::remainderofword]
..
.
.\" this should be the last line
---------------- cut here ---------------- cut here ----------------
.sp
.ps 16
.vs 20
.mso dropcap.tmac
.defcolor darkblue rgb 0.1f 0.1f 0.3f
.dropcap An 4 darkblue R T -3n +1n
example of the use of dropcap macro with Keith's and Werner's patches
applied. We can see that the initial adjustment value pulls in the
first line and the second adjustment value provides the line
increment.  However as noted by Keith it fails when the user specifies
vertical space during a drop capital.  For example
.sp
.dropcap Another 4 darkblue R T -3n +1n
test for a drop A but this time we request a space before the text
finishes the drop capital.
.sp 4
And now for another test
.sp
.dropcap When 4 darkblue R T 0 -0.5n -1n
appropriate adjustment parameters are specified, it produces a rather
nice effect, as we can see the subsequent lines indented by -1n each
line down the drop capital. It is possible to append more parameters
to this macro, each parameter indicates the relative indentation for
the next line.  Therefore it is possible to make text pull in and out
of a drop capital I.
.sp
.dropcap In 7 darkblue R T 0 -1n 0 0 0 0 1n
an attempt to provide an example of the drop capital macro I needed to
write some text. This is always problematic and I wish I could just
hash include some dummy text instead.  In an attempt to provide an
example of the drop capital macro I needed to write some text. This is
always problematic and I wish I could just hash include some dummy
text instead.  In an attempt to provide an example of the drop capital
macro I needed to write some text. This is always problematic and I
wish I could just hash include some dummy text instead.





reply via email to

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