[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Help with crop marks code
From: |
Daode |
Subject: |
Re: [Groff] Help with crop marks code |
Date: |
Thu, 28 Nov 2013 14:46:52 +0100 |
User-agent: |
s-nail v14.4.5-49-g8456b16 |
Walter Alejandro Iglesias <address@hidden> wrote:
|Searching for how implement crop marks with groff I've found this:
[.]
|I would appreciate some clue or a point to some documentation.
Well i have no crop marks but used "fold marks" for letters and
when punchers had to be adjusted, but you can paint whatever you
want, of course, just use different \D'' requests.
It's part of a larger thing, here only excerpts -- the attached
'test.tr' is their runnable version.
Can be set and managed via global switches:
.\".ds S:FOLDMARKS true
.\".nr S:#FOLDMARKS_OFFSET 0.25c
.MACRO FOLDMARKS \" $1=bool, [$2=offset]
. S:BOOLIFY \\$1
. ie \\n[S:#IS_BOOL] \{\
. ds S:FOLDMARKS true
. ie '\\$2'' .nr S:#FOLDMARKS_OFFSET 0.25c
. el .nr S:#FOLDMARKS_OFFSET \\$2
. \}
. el \{\
. rm S:FOLDMARKS
. rr S:#FOLDMARKS_OFFSET
. \}
..
Some generic positioning support
.aln ROFF:#PAGENO %
.aln ROFF:#VERT_POS nl
.aln ROFF:#HORIZ_POS .k
.aln ROFF:#INDENT .i
.aln ROFF:#PAGE_OFFSET .o
.de S:SAVE_POSITION
. nr S:#SAVE_POS#V \\n[ROFF:#VERT_POS]
. nr S:#SAVE_POS#H \\n[ROFF:#HORIZ_POS]
..
.de S:RESTORE_POSITION
. sp |\\n[S:#SAVE_POS#V]u
\\h'|\\n[S:#SAVE_POS#H]u'\c
..
The foldmark painter itself.
All it effectively does is to move absolutely and paint two
horizontal lines at precalculated positions; using different
absolute .sp in combination with several \D''s should do what you
desire?
.de S:FOLDMARKS_PUT
. nr #1 \\n[S:#PAGE_HEIGHT]u/3u
. nr #2 \\n(#1u-\\n[S:#PRINTER_MARGIN_TOP]u
. nr #3 \\n(#2u+\\n(#1u
.\" FIXME Does not take care for printer margin left+
.\" nr #1 \\n[S:#MARGIN_LEFT]+\\n[ROFF:#HORIZ_POS]-\\n[S:#FOLDMARKS_OFFSET]
. nr #1 \\n[ROFF:#PAGE_OFFSET]+\\n[ROFF:#INDENT]-\\n[S:#FOLDMARKS_OFFSET]
. S:SAVE_POSITION
. sp |\\n[#2]u
\\Z'\
\\h'|-\\n(#1u'\
\\D't 0.5p'\
\\l'5p'\
'
. sp |\\n[#3]u
\\Z'\
\\h'|-\\n(#1u'\
\\D't 0.5p'\
\\l'5p'\
'
. S:RESTORE_POSITION
. rr #4
. rr #3
. rr #2
. rr #1
..
That thing is called from another entry
.de S:CHECK_TOP_BOXES
[.]
. ds S:TOP_BOXES_SET
. if d S:FOLDMARKS .S:FOLDMARKS_PUT
[.]
which in turn gets called from page-top, EOF and paragraph
(but this only '.if (\\n[ROFF:#PAGENO] = 1) \{\') traps.
.de S:TRAP_TOP
[.]
. S:CALC_LAYOUT
' sp |\\n[S:#PAGE_START]u
. rm S:TOP_BOXES_SET
. rm S:BOTTOM_BOXES_SET
. if (\\n[ROFF:#PAGENO] > 1) .S:CHECK_TOP_BOXES
[.]
.wh 0 S:TRAP_TOP
.de S:TRAP_EOF
[.]
. if !d S:TOP_BOXES_SET .S:CHECK_TOP_BOXES
. if !d S:BOTTOM_BOXES_SET .S:CHECK_BOTTOM_BOXES
..
.em S:TRAP_EOF
iirc it was a terrible mess to implement right back then, but it
got better once i realized that the printer imposes its own
margins a.k.a. has a supported drawable area. It never was done
right, then, however (i.e., has been adjusted to take all
possible margins into account). :(
--steffen
--- Begin Message ---
Subject: |
[Groff] Help with crop marks code |
Date: |
Thu, 28 Nov 2013 12:04:52 +0100 |
User-agent: |
Mutt/1.5.22 (2013-10-16) |
Hello all,
Searching for how implement crop marks with groff I've found this:
http://article.gmane.org/gmane.comp.printing.groff.general/7804
That do the job but I am a bit lost with the code. I couldn't find
documentation on internet to understand it and be able to modify it to fit the
A4 paper format I use.
I would appreciate some clue or a point to some documentation.
Thanks in advace.
Walter
--- End Message ---
test.tr
Description: Text Data