summaryrefslogtreecommitdiff
path: root/tmac
diff options
context:
space:
mode:
authorwl <wl>2012-05-20 13:58:09 +0000
committerwl <wl>2012-05-20 13:58:09 +0000
commit0ba10d251a10e8b7453fad8877e529a5c2e26f96 (patch)
tree816dea7244660f65e6fae78b540b8dafafbd949a /tmac
parent496b379176b94e41aa03f7779bb3bac06e91c783 (diff)
downloadgroff-0ba10d251a10e8b7453fad8877e529a5c2e26f96.tar.gz
* doc/groff.texinfo: Add extra info about `.asciify'.
Document new gropdf options -u and -s. * src/devices/gropdf/gropdf.man: Remove references to Type 42 fonts, they do not work in PDFs. Document new option -s which adds `statistics' line to end of PDF file showing number of pages in document. This has always been the default behaviour (to add this line), all other software seems to ignore it as intended, but `gs' sometimes complains, so the default is now to omit the statistics. Document new option -u[cmapfilename] to allow a user ToUnicode CMap instead of gropdf's default. If no `cmapfilename' given then do not include any ToUnicode CMap. * src/devices/gropdf/gropdf.pl <top>: Allow `bundled' flags on command line (i.e. -de = -d -e). Use $RT_SEP as multi path separator, not hard coded `:'. Update all users. New flags -u and -s. Once a custom papersize has been set as \X'papersize x,y' make it sticky so all following pages use custom size. When importing pdf with \X'pdf: pdfpic ...' do not compress objects which are already compressed! This caused problems with PDFs created with ImageMagick, now fixed. (IsText, PutLine, do_t): The troff `u' command can contain a kerning adjustment number, this was not being handled, now fixed. (do_c): The troff `c' command was not being handled correctly, now fixed. (FindChar, RemapChr, do_N): Handle fonts with more than 255 glyphs. ($ucmap): Define CMap ToUnicode to convert ligatures (fl,fi,ff,ffl,ffi) back to individual characters, useful for cut'n'paste and text searching. (LoadFont): Handle it. (ToPoints, GetPoints): Handle `z' unit. (do_x, FixPDFColour, PutHotSpot): Allow Annotation colour to be groff colour, i.e. 0-65535 *3, or #rrggbb, or #rrrrbbbbgggg. (do_p):The papersize width/length in switch -p were reversed, corrected. * src/devices/gropdf/Makefile.sub (gropdf): Use $RT_SEP. Use $fontpath rather than $fontdir (this ensures site-font is included in searches). * tmac/pdf.tmac (PDFBOOKMARK.VIEW, PDFHREF.VIEW, PDFPAGE.Y): Fix strings. (pdfbookmark): Correct handling of bookmark levels. Convert \[em] to hyphen in bookmarks Rather use -N than -T for "named" bookmarks (-T already used for "tag" in pdfmark.tmac) (.pdfclean): New macro which attempts to asciify bookmark text. (.pdfpagename): New wrapper macro for \X'pdf: pagename'. (.pdfswitchtopage): New wrapper macro for \X'pdf: switchtopage'.
Diffstat (limited to 'tmac')
-rw-r--r--tmac/pdf.tmac45
1 files changed, 38 insertions, 7 deletions
diff --git a/tmac/pdf.tmac b/tmac/pdf.tmac
index 844e3f74..68fa9e5a 100644
--- a/tmac/pdf.tmac
+++ b/tmac/pdf.tmac
@@ -144,7 +144,7 @@
.\" the page width to the viewing window, with the bookmarked entry
.\" located at the top of the viewable area.
.\"
-.ds PDFBOOKMARK.VIEW /FitH -\\n[PDFPAGE.Y] u
+.ds PDFBOOKMARK.VIEW /FitH \\n[PDFPAGE.Y] u
.\"
.\" "PDFOUTLINE.FOLDLEVEL" controls how the document outline will be
.\" displayed. It is a number, defining the maximum heading level
@@ -189,7 +189,7 @@
. \"
. nr pdf:bm.lev 0+\\$1
. if \\n[pdf:bm.lev]==0 .nr pdf:bm.lev 1
-. if \\n[pdf:bm.lev]>\\n[PDFOUTLINE.FOLDLEVEL] .nr pdf:bm.lev \\n[pdf:bm.lev]*-1
+. if \\n[pdf:bm.lev]-1==\\n[PDFOUTLINE.FOLDLEVEL] .nr pdf:bm.lev \\n[pdf:bm.lev]*-1
. nr pdf:bm.abslev 0+\\n[pdf:bm.lev]
. if \\n[pdf:bm.lev]<0 .nr pdf:bm.abslev 0+\\n[pdf:bm.abslev]*-1
. if \\n[pdf:bm.abslev]>\\n[pdf:bm.nl] .nr pdf:bm.nl \\n[pdf:bm.nl]+1
@@ -213,18 +213,24 @@
. pdf:href.sety
. ds pdf:cleaned \\$*
. ev pdfcln
+. tr \[em]-
. nf
. box pdf:clean
. nop \\$*
-. sp -1
+. fl
. box
+. chop pdf:clean
. asciify pdf:clean
+. length pdf:clean:len \\*[pdf:clean]
. ds pdf:cleaned \\*[pdf:clean]
+. rm pdf:clean
. ev
+. tr \[em]\[em]
. ds pdf:look(\\*[PDFBOOKMARK.NAME]) \\*[pdf:cleaned]
. if dPDF.EXPORT .tm .ds pdf:look(\\*[PDFBOOKMARK.NAME]) \\*[pdf:cleaned]
. pdfmark /Dest /\\*[PDFBOOKMARK.NAME] /View [\\*[PDFBOOKMARK.VIEW]] /DEST
-. pdfmark /Dest /\\*[PDFBOOKMARK.NAME] /Title (\\*[pdf:cleaned]) /Level \\n[pdf:bm.lev] /OUT
+. nop \!x X ps:exec [/Dest /\\*[PDFBOOKMARK.NAME] /Title (\\*[pdf:cleaned]) /Level \\n[pdf:bm.lev] /OUT pdfmark
+.\". pdfmark /Dest /\\*[PDFBOOKMARK.NAME] /Title "(\\*[pdf:cleaned])" /Level \\n[pdf:bm.lev] /OUT
. pdf:href.options.clear
. rr PDFPAGE.Y
. rm pdf:cleaned
@@ -240,6 +246,25 @@
. nop \!.pdfbookmark \\$@
. \}
..
+.
+.de pdfclean
+. ie '\\n(.z'' \{\
+. ds pdfcleaned \\$*
+. ev pdfcln
+. tr \[em]-
+. nf
+. box pdf:clean
+. nop \\*[\\*[pdfcleaned]]
+. fl
+. box
+. chop pdf:clean
+. asciify pdf:clean
+. ev
+. ds \\*[pdfcleaned] "\\*[pdf:clean]
+. rm pdf:clean
+. tr \[em]\[em]
+. el .nop \!.pdfclean \\$@
+..
.\"
.\" =============================================================
.\" Module PDFHREF: Create Hypertext References in a PDF Document
@@ -248,7 +273,7 @@
.\" "PDFHREF.VIEW" controls how the document will be displayed,
.\" when the user follows a link to a named reference.
.\"
-.ds PDFHREF.VIEW /FitH -\\n[PDFPAGE.Y] u
+.ds PDFHREF.VIEW /FitH \\n[PDFPAGE.Y] u
.\"
.\" This default setting will fit the page width to the viewing
.\" window, with the bookmarked entry located close to the top
@@ -278,7 +303,7 @@
.\" in groff's basic units; don't forget to append grops' "u"
.\" conversion operator, when writing the pdfmark!
.\"
-.nr PDFPAGE.Y \\n(nl-\\n[PDFHREF.VIEW.LEADING]
+.nr PDFPAGE.Y (\\n[PDFHREF.VIEW.LEADING]-\\n(nl)
..
.\" When we create a link "hot-spot" ...
.\" "PDFHREF.LEADING" sets the distance above the top of the glyph
@@ -647,7 +672,7 @@
. \" limits of its bounding box(es), as the before and after output
. \" text positions.
. \"
-. if dPDFHREF.COLOUR .defcolor pdf:href.colour rgb \\*[PDFHREF.COLOUR]
+\#. if dPDFHREF.COLOUR .defcolor pdf:href.colour rgb \\*[PDFHREF.COLOUR]
. nr pdf:bm.width \\w'\\*[PDFHREF.DESC]'
. nop \&\m[\\*[PDFHREF.TEXT.COLOUR]]\X'pdf: markstart \\n[rst] \\n[rsb] \\n[PDFHREF.LEADING] \\*[pdf:href.link]'\\*[PDFHREF.DESC]\X'pdf: markend'\m[]\c
. \"
@@ -735,5 +760,11 @@
.de pdfmarkrestart
.nop \!x X pdf: markrestart
..
+.de pdfpagename
+.nop \!x X pdf: pagename \\$1
+..
+.de pdfswitchtopage
+.nop \!x X pdf: switchtopage \\$*
+..
.\"
.\" pdf.tmac: end of file / vim: ft=groff