/[groff]/groff/contrib/pdfmark/pdfmark.tmac
ViewVC logotype

Diff of /groff/contrib/pdfmark/pdfmark.tmac

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by wl, Wed Dec 8 08:31:17 2004 UTC revision 1.2 by wl, Mon Feb 28 13:56:45 2005 UTC
# Line 455  inspiration has come from discussion on Line 455  inspiration has come from discussion on
455  .nr PDFPAGE.Y \\n(.p-\\n(nl+\\n[PDFHREF.VIEW.LEADING]  .nr PDFPAGE.Y \\n(.p-\\n(nl+\\n[PDFHREF.VIEW.LEADING]
456  ..  ..
457  .\" When we create a link "hot-spot" ...  .\" When we create a link "hot-spot" ...
458  .\" "PDFHREF.LEADING" sets the distance above the top of the glyphs,  .\" "PDFHREF.LEADING" sets the distance above the top of the glyph
459  .\" over which the hot spot will extend, while "PDFHREF.HEIGHT" sets  .\" bounding boxes, in each line of link text, over which the link
460  .\" the hot spot height, PER LINE of text occupied by the reference.  .\" hot-spot will extend, while "PDFHREF.HEIGHT" sets the hot-spot
461  .\"  .\" height, PER LINE of text occupied by the reference.
462  .\" 2.5 points is a reasonable default value for "PDFHREF.LEADING";  .\"
463  .\" (it may be changed, if desired). "PDFHREF.HEIGHT" is initially  .\" Since most fonts specify some leading space within the bounding
464  .\" set as one vertical spacing unit -- note that it is defined as  .\" boxes of their glyphs, a better appearance may be achieved when
465  .\" a string, so it will adapt to changes in the vertical spacing;  .\" NEGATIVE leading is specified for link hot-spots;  indeed, when
466  .\" (changing it is NOT RECOMMENDED).  .\" the default 10pt Times font is used, -1.0 point seems to be a
467    .\" reasonable default value for "PDFHREF.LEADING" -- it may be
468    .\" changed, if desired.
469    .\"
470    .\" "PDFHREF.HEIGHT" is initially set as one vertical spacing unit;
471    .\" note that it is defined as a string, so it will adapt to changes
472    .\" in the vertical spacing.  Changing it is NOT RECOMMENDED.
473  .\"  .\"
474  .nr PDFHREF.LEADING  2.5p  .nr PDFHREF.LEADING -1.0p
475  .ds PDFHREF.HEIGHT   1.0v  .ds PDFHREF.HEIGHT   1.0v
476  .\"  .\"
477  .\" PDF readers generally place a rectangular border around link  .\" PDF readers generally place a rectangular border around link
# Line 529  inspiration has come from discussion on Line 535  inspiration has come from discussion on
535  .      nr pdf:href-X 0  .      nr pdf:href-X 0
536  .   \"  .   \"
537  .   \" Handle the case where subcommand is specified as "-class",  .   \" Handle the case where subcommand is specified as "-class",
538  .   \" setting up appropriate macro aliases for subcommand handlers,  .   \" setting up appropriate macro aliases for subcommand handlers.
 .   \" and adjusting "pdf:href.ok" to indicate where a reference  
 .   \" file list is required  
539  .   \"  .   \"
540  .      if dpdf*href\\$1       .als pdf*href      pdf*href\\$1  .      if dpdf*href\\$1       .als pdf*href      pdf*href\\$1
541  .      if dpdf*href\\$1.link  .als pdf*href.link pdf*href\\$1.link  .      if dpdf*href\\$1.link  .als pdf*href.link pdf*href\\$1.link
542  .      if dpdf*href\\$1.file  .als pdf*href.file pdf*href\\$1.file  .      if dpdf*href\\$1.file  .als pdf*href.file pdf*href\\$1.file
543  .   \"  .   \"
544  .   \" Repeat macro alias and "pdf:href.ok" setup  .   \" Repeat macro alias setup
545  .   \" for the case where the subcommand is specified as "class",  .   \" for the case where the subcommand is specified as "class",
546  .   \" (without a leading hyphen)  .   \" (without a leading hyphen)
547  .   \"  .   \"
# Line 590  inspiration has come from discussion on Line 594  inspiration has come from discussion on
594  .\" and for decoding options with arguments, respectively  .\" and for decoding options with arguments, respectively
595  .\"  .\"
596  .de pdf:href.flag  .de pdf:href.flag
597    .\" ----------------------------------------------------------------------
598    .\" ----------------------------------------------------------------------
599  .nr pdf:href\\$1 1  .nr pdf:href\\$1 1
600  .nr pdf:href.argc 1  .nr pdf:href.argc 1
601  ..  ..
602  .de pdf:href.option  .de pdf:href.option
603    .\" ----------------------------------------------------------------------
604    .\" ----------------------------------------------------------------------
605  .ds pdf:href\\$1 \\$2  .ds pdf:href\\$1 \\$2
606  .nr pdf:href.argc 2  .nr pdf:href.argc 2
607  ..  ..
# Line 715  inspiration has come from discussion on Line 723  inspiration has come from discussion on
723  ..  ..
724  .\"  .\"
725  .de pdf*href.set  .de pdf*href.set
726    .\" ----------------------------------------------------------------------
727    .\" ----------------------------------------------------------------------
728  .pdf*href.map.init  .pdf*href.map.init
729  .ie \\n(.$ \{\  .ie \\n(.$ \{\
730  .   \"  .   \"
# Line 760  inspiration has come from discussion on Line 770  inspiration has come from discussion on
770  .el \!.\\$0 \\$@  .el \!.\\$0 \\$@
771  ..  ..
772  .\"  .\"
773    .\" Macro "pdf*href-D" is invoked when "pdfhref" is called
774    .\" with the "D" reference class specifier; it provides a
775    .\" standardised mechanism for interpreting reference data
776    .\" exported by the "M" reference class, and may be used
777    .\" to directly define external reference data, without the
778    .\" use of "M" reference class designators in the source
779    .\" document.
780    .\"
781    .de pdf*href-D
782    .ds pdf:href-N
783    .\"
784    .\" Parse, interpret, and strip any specified options from the
785    .\" argument list.  (Note that only options with a declared handler
786    .\" will be processed; there is no provision for detecting invalid
787    .\" options -- anything which is not recognised is assumed to start
788    .\" the "descriptive text" component of the argument list).
789    .\"
790    .while dpdf:href.opt\\$1 \{\
791    .   pdf:href.opt\\$1 \\$@
792    .   shift \\n[pdf:href.argc]
793    .   \}
794    .\"
795    .\" If we found "--", to mark the end of the options,
796    .\" then we should discard it.
797    .\"
798    .if '\\$1'--' .shift
799    .\"
800    .ie '\\*[pdf:href-N]'' \{\
801    .   pdf:warn pdfhref defined reference requires a name
802    .   \}
803    .el \{\
804    .   ds pdf:href(\\*[pdf:href-N]).info \\$*
805    .   \}
806    ..
807    .\"
808  .\" Macro "pdf*href-F" is invoked when "pdfhref" is called  .\" Macro "pdf*href-F" is invoked when "pdfhref" is called
809  .\" with the "F" reference class specifier; it allows the user  .\" with the "F" reference class specifier; it allows the user
810  .\" to provide an alternative interpreter macro, which will be  .\" to provide an alternative interpreter macro, which will be
# Line 848  inspiration has come from discussion on Line 893  inspiration has come from discussion on
893  .ds PDFHREF.TEXT \\*[PDFHREF.TEXT]  .ds PDFHREF.TEXT \\*[PDFHREF.TEXT]
894  ..  ..
895  .de pdf*href.format.file  .de pdf*href.format.file
896    .\" ----------------------------------------------------------------------
897  .\" Include a file identifier in a formatted reference.  .\" Include a file identifier in a formatted reference.
898  .\" This is invoked ONLY by "pdf*href.format", and ONLY IF the  .\" This is invoked ONLY by "pdf*href.format", and ONLY IF the
899  .\" reference data includes an initial file identifier tuple.  .\" reference data includes an initial file identifier tuple.
900    .\" ----------------------------------------------------------------------
901  .\"  .\"
902  .as PDFHREF.TEXT " \\*[PDFHREF.FILEREF]  .as PDFHREF.TEXT " \\*[PDFHREF.FILEREF]
903  ..  ..
904  .de pdf*href.format.page  .de pdf*href.format.page
905    .\" ----------------------------------------------------------------------
906  .\" Include a page number in a formatted reference.  .\" Include a page number in a formatted reference.
907  .\" This is invoked ONLY by "pdf*href.format", and ONLY IF the  .\" This is invoked ONLY by "pdf*href.format", and ONLY IF the
908  .\" reference data includes an initial page number tuple.  .\" reference data includes an initial page number tuple.
909    .\" ----------------------------------------------------------------------
910  .\"  .\"
911  .as PDFHREF.TEXT " \\*[PDFHREF.PAGEREF]  .as PDFHREF.TEXT " \\*[PDFHREF.PAGEREF]
912  ..  ..
913  .de pdf*href.format.section  .de pdf*href.format.section
914    .\" ----------------------------------------------------------------------
915  .\" Include a section number in a formatted reference.  .\" Include a section number in a formatted reference.
916  .\" This is invoked ONLY by "pdf*href.format", and ONLY IF the  .\" This is invoked ONLY by "pdf*href.format", and ONLY IF the
917  .\" reference data includes an initial section number tuple.  .\" reference data includes an initial section number tuple.
918    .\" ----------------------------------------------------------------------
919  .\"  .\"
920  .as PDFHREF.TEXT " \\*[PDFHREF.SECTREF]  .as PDFHREF.TEXT " \\*[PDFHREF.SECTREF]
921  ..  ..
# Line 1042  inspiration has come from discussion on Line 1093  inspiration has come from discussion on
1093  .nop \&\\*[pdf:href-A]  .nop \&\\*[pdf:href-A]
1094  ..  ..
1095  .de pdf*href.map.init  .de pdf*href.map.init
1096    .\" ----------------------------------------------------------------------
1097    .\" ----------------------------------------------------------------------
1098  .\"  .\"
1099  .if dpdf:href.map-1 \{\  .if dpdf:href.map-1 \{\
1100  .   \"  .   \"
# Line 1056  inspiration has come from discussion on Line 1109  inspiration has come from discussion on
1109  .   \}  .   \}
1110  .als pdf*href.map.init pdf*href.mark.idle  .als pdf*href.map.init pdf*href.mark.idle
1111  ..  ..
1112    .\"
1113    .\" "pdf*href-Z" is used to add link co-ordinate entries to the
1114    .\" "pdf:href.map".  Primarily, it is used by the "pdfroff" formatter,
1115    .\" to pass link co-ordinate data from one "groff" formatting pass to
1116    .\" the next, and is not generally useful to the end user.
1117    .\"
1118    .de pdf*href-Z
1119    .\" ----------------------------------------------------------------------
1120    .\" Usage:
1121    .\"   .pdfhref Z page-index x-displacement y-displacement
1122    .\" Where:
1123    .\"   page-index      is the reference mark's page number
1124    .\"   x-displacement  is its offset from the left edge of the page
1125    .\"   y-displacement  is its offset from the top edge of the page
1126    .\" ( both displacement values are expressed in basic groff units, )
1127    .\" ( and measured perpendicular to their respective page edges.   )
1128    .\" ----------------------------------------------------------------------
1129    .\"
1130    .ie \\n(.$=3 .ds pdf:href.map-\\n+[pdf*href-Z.index] \\$*
1131    .el .pdf:error pdfhref Z operator expects exactly three arguments
1132    ..
1133    .\" Initialise the auto-incrementing "pdf*href-Z.index" register,
1134    .\" to ensure that sub-map numbering starts at 1.
1135    .\"
1136    .nr pdf*href-Z.index 0 1
1137    .\"
1138  .de pdf*href.map.read  .de pdf*href.map.read
1139  .\" ----------------------------------------------------------------------  .\" ----------------------------------------------------------------------
1140  .\" Usage: (internal use only):  .\" Usage: (internal use only):
# Line 1092  inspiration has come from discussion on Line 1171  inspiration has come from discussion on
1171  .\"  .\"
1172  .rr pdf:null  .rr pdf:null
1173  ..  ..
1174  .\"  .de pdf*href.mark.begin
 .\" The "pdf*href.mark" macro is called internally, by "pdf*href", to  
 .\" mark the start and end co-ordinates of the "link text" bounding box.  
 .\" These are then used as the basis for computing the bounding box(es)  
 .\" for the associated link "hot-spot".  
 .\"  
 .de pdf*href.mark(unused)  
1175  .\" ----------------------------------------------------------------------  .\" ----------------------------------------------------------------------
 .\" Usage: (internal use only):  
 .\"   .pdf*href.mark co-ordinate name list ...  
1176  .\" ----------------------------------------------------------------------  .\" ----------------------------------------------------------------------
 .\"  
 .\" Reads values from "pdf:href.map" to each named register, in turn  
 .\" Reading to "null" discards the corresponding value in "pdf:href.map"  
 .\"  
 .\" Note that this requires two pass processing in "groff" ...  
 .\" In pass 1, "pdf:href.map" is undefined; in pass 2, we source the  
 .\" filtered output from pass 1, which defines it, (in terms of a series  
 .\" of indexed sub-maps: "pdf:href.map-1" .. "pdf:href.map-N").  
 .\"  
1177  .pdf*href.map.init  .pdf*href.map.init
1178  .ie !dpdf:href.map \{\  .ie dpdf:href.map \{\
 .   \"  
 .   \" In the first pass, we use the "grohtml" hook, to emit bounding  
 .   \" box co-ordinates to "stderr"; (note that we use a zero width  
 .   \" marker character, to obtain useful output -- we don't care that  
 .   \" these may be visible, since this is effectively a "dummy run"  
 .   \" through the formatter, and its PostScript output will be  
 .   \" discarded).  
 .   \"  
 .   nop \O1|\h'-\w"|"u'\O2\c  
 .   \}  
 .el \{\  
1179  .   \"  .   \"
1180  .   \" In the second pass, we harvest the bounding box co-ordinates,  .   \" Once we have established a document reference map,
1181  .   \" which we read back from the reprocessed "stderr" output from  .   \" then this, and all subsequent calls to "pdf*href.mark.begin",
1182  .   \" the first pass, and assign them to specified registers.  .   \" may be redirected to the reference mark resolver, and the
1183  .   \" First however, we will create an internal reference to the  .   \" "pdf*href.mark.end" macro has nothing further to do.
 .   \" "pdf:href.map"; we will read co-ordinates via this internal  
 .   \" reference, to ensure the "pdf:href.map" is not deleted from  
 .   \" the string namespace, when its data is exhausted.  
1184  .   \"  .   \"
 .   pdf*href.map.read \\$@  
 .   \}  
 ..  
 .de pdf*href.mark.begin  
 .pdf*href.map.init  
 .ie dpdf:href.map \{\  
1185  .   pdf*href.mark.resolve \\$@  .   pdf*href.mark.resolve \\$@
1186  .   rn pdf*href.mark.resolve pdf*href.mark.begin  .   rn pdf*href.mark.resolve pdf*href.mark.begin
1187  .   als pdf*href.mark.end pdf*href.mark.close  .   als pdf*href.mark.end pdf*href.mark.idle
1188  .   \}  .   \}
1189  .el \{\  .el \{\
1190    .   \" Since we don't yet have a document reference map, the
1191    .   \" reference mark resolver will not work, in this pass of the
1192    .   \" formatter;  this, and all subsequent calls to "pdf*href.mark.begin",
1193    .   \" may be redirected to "pdf*href.mark.end", which is responsible
1194    .   \" for emitting the reference mark data to be incorporated into
1195    .   \" the reference map in a subsequent formatting pass.
1196    .   \"
1197  .   pdf*href.mark.end  .   pdf*href.mark.end
1198  .   als pdf*href.mark.begin pdf*href.mark.end  .   als pdf*href.mark.begin pdf*href.mark.end
1199  .   \}  .   \}
1200  ..  ..
1201  .de pdf*href.mark.resolve  .de pdf*href.mark.resolve
1202    .\" ----------------------------------------------------------------------
1203    .\" ----------------------------------------------------------------------
1204  .ie '\\n(.z'' \{\  .ie '\\n(.z'' \{\
1205  .   ds pdf:href.link \\$1  .   ds pdf:href.link \\$1
1206  .   pdf*href.map.read spg llx ury epg  .   nr pdf:urx \\n(.o+\\n(.l
1207    .   pdf*href.map.read spg llx ury epg urx.end lly.end
1208  .   ie \\n[pdf:spg]=\\n[pdf:epg] \{\  .   ie \\n[pdf:spg]=\\n[pdf:epg] \{\
1209  .      \"  .      \"
1210  .      \" This link is entirely contained on a single page ...  .      \" This link is entirely contained on a single page ...
1211  .      \" emit the text, which defines the content of the link region,  .      \" emit the text, which defines the content of the link region,
1212  .      \" then make it active.  .      \" then make it active.
1213  .      \"  .      \"
1214  .      pdf*href.map.read urx lly  .      pdf*href.mark.emit 1 \\n[pdf:urx.end]
1215  .      ie \\n[pdf:ury]=\\n[pdf:lly] \{\  .      if \\n[pdf:lly]<\\n[pdf:lly.end] \{\
 .         \"  
 .         \" This link is entirely contained on a single output line;  
 .         \" we may simply emit the "hot-spot" PDFMARK definition, as  
 .         \" it has already been established.  
1216  .         \"  .         \"
 .         pdf*href.mark.emit 1  
 .         \}  
 .      el \{\  
1217  .         \" This link spans multiple output lines; we must save its  .         \" This link spans multiple output lines; we must save its
1218  .         \" original end co-ordinates, then define a new intermediate  .         \" original end co-ordinates, then define a new intermediate
1219  .         \" end point, to create a PDFMARK "hot-spot" extending from  .         \" end point, to create a PDFMARK "hot-spot" extending from
1220  .         \" the start of the link to the end if its first line.  .         \" the start of the link to the end if its first line.
1221  .         \"  .         \"
 .         nr pdf:urx.end \\n[pdf:urx]  
 .         nr pdf:ury.end \\n[pdf:lly]-\\n[PDFHREF.LEADING]  
 .         nr pdf:urx \\n(.o+\\n(.l  
 .         pdf*href.mark.emit 1  
 .         \"  
 .         \" Now, we adjust the initial "hot-spot" co-ordinates, to  
 .         \" mark the beginning of its second line.  
 .         \"  
 .         nr pdf:llx \\n(.o+\\n[.in]  
1222  .         nr pdf:ury +1v  .         nr pdf:ury +1v
1223  .         if !\\n[pdf:ury.end]=\\n[pdf:ury] \{\  .         nr pdf:llx \\n(.o+\\n[.in]
1224  .            \"  .         nr pdf:lly \\n[pdf:lly.end]-\\*[PDFHREF.HEIGHT]
1225  .            \" This link spans MORE than two lines, so we redefine  .         if \\n[pdf:ury]<\\n[pdf:lly] \{\
1226  .            \" its intermediate end point, in order to create a second  .            nr pdf:lly +\\*[PDFHREF.HEIGHT]-1v
 .            \" "hot-spot", which spans all but the first and last lines  
 .            \" of the "link text".  
 .            \"  
 .            nr pdf:lly \\n[pdf:ury.end]-1v+\\*[PDFHREF.HEIGHT]  
1227  .            pdf*href.mark.emit 2  .            pdf*href.mark.emit 2
1228    .            nr pdf:ury \\n[pdf:lly.end]-\\*[PDFHREF.HEIGHT]
1229  .            \}  .            \}
1230  .         \" Finally, we adjust the "hot-spot" bounds once more, to  .         pdf*href.mark.emit 0 \\n[pdf:urx.end]
 .         \" create a final "hot-spot", which extends from the start of  
 .         \" the last line of the "link text" to the originally computed  
 .         \" "hot-spot" end point.  
 .         \"  
 .         nr pdf:urx \\n[pdf:urx.end]  
 .         nr pdf:ury \\n[pdf:ury.end]  
 .         rr pdf:urx.end pdf:ury.end  
 .         pdf*href.mark.emit 0  
1231  .         \}  .         \}
1232    .      pdf*href.mark.flush
1233  .      \}  .      \}
1234  .   el \{\  .   el \{\
1235  .      \" This link is split across a page break, so ...  .      \" This link is split across a page break, so ...
# Line 1214  inspiration has come from discussion on Line 1240  inspiration has come from discussion on
1240  .      \" First step: define the region from the start of the link,  .      \" First step: define the region from the start of the link,
1241  .      \" to the end of its first line.  .      \" to the end of its first line.
1242  .      \"  .      \"
1243  .      nr pdf:urx \\n(.o+\\n(.l  .      pdf*href.mark.emit 1 \\n[pdf:urx]
 .      pdf*href.mark.emit 1  
 .      \"  
 .      \" Save the vertical trim distance, between the current text  
 .      \" base line and the top of the actual "hot-spot" region, so we  
 .      \" can make a similar adjustment at the top of the next page.  
 .      \"  
 .      mk pdf:ury.trim  
 .      nr pdf:ury.trim \\n[pdf:ury]-\\n[pdf:ury.trim]  
1244  .      \"  .      \"
1245  .      \" All additional regions MUST align with the left margin.  .      \" All additional regions MUST align with the left margin.
1246  .      \"  .      \"
# Line 1248  inspiration has come from discussion on Line 1266  inspiration has come from discussion on
1266  .         \" termination handler, to deactivate it when done.  .         \" termination handler, to deactivate it when done.
1267  .         \"  .         \"
1268  .         als pdf*href.mark.hook pdf*href.mark.trap  .         als pdf*href.mark.hook pdf*href.mark.trap
 .         als pdf*href.mark.end  pdf*href.mark.release  
1269  .         \"  .         \"
1270  .         \" Now we set up "pdf:epg" to count the number of page breaks  .         \" Now we set up "pdf:epg" to count the number of page breaks
1271  .         \" which this link will span, and emit the link text, leaving  .         \" which this link will span, and emit the link text, leaving
# Line 1263  inspiration has come from discussion on Line 1280  inspiration has come from discussion on
1280  .         \" we may discard the remaining map data for this link,  .         \" we may discard the remaining map data for this link,
1281  .         \" and issue a diagnostic.  .         \" and issue a diagnostic.
1282  .         \"  .         \"
 .         pdf*href.map.read null null  
1283  .         pdf:error pdfhref: link dissociated at page break (trap not initialised)  .         pdf:error pdfhref: link dissociated at page break (trap not initialised)
1284  .         if dPDFHREF.BROKEN.COLOR \{\  .         if dPDFHREF.BROKEN.COLOR \{\
1285  .            \"  .            \"
# Line 1290  inspiration has come from discussion on Line 1306  inspiration has come from discussion on
1306  .de pdf*href.mark.emit  .de pdf*href.mark.emit
1307  .\" ----------------------------------------------------------------------  .\" ----------------------------------------------------------------------
1308  .\" Usage:  .\" Usage:
1309  .\"   .pdf*href.mark.emit <action>  .\"   .pdf*href.mark.emit <action> [<end-urx>]
1310  .\"     <action> == 0 --> normal operation -- link height = 1 line  .\"     <action> == 0 --> normal operation -- link height = 1 line
1311  .\"     <action> == 1 --> start of link -- add leading above text  .\"     <action> == 1 --> start of link -- add leading above text
1312  .\"     <action> == 2 --> overtall link -- set intermediate baseline  .\"     <action> == 2 --> overtall link -- set intermediate baseline
1313  .\"     <action> == 3 --> split link -- break at bottom of page  .\"     <action> == 3 --> split link -- break at bottom of page
1314  .\" ----------------------------------------------------------------------  .\" ----------------------------------------------------------------------
1315  .\"  .\"
1316  .if \\$1=1 .nr pdf:ury -\\n[PDFHREF.LEADING]  .if \\$1=1 \{\
1317  .if \\$1<2 .nr pdf:lly \\n[pdf:ury]u+\\*[PDFHREF.HEIGHT]  .   \"
1318    .   \" Initialising a new link region ...
1319    .   \" Some different versions of "groff" disagree about the vertical
1320    .   \" displacement of "opminy", as emitted by "\O1|\h'-\w"|"u'\O2\c",
1321    .   \" relative to the current text baseline.  Therefore, recompute
1322    .   \" the link displacement, independently of "opminy".
1323    .   \"
1324    .   mk pdf:ury.base
1325    .   while \\n[pdf:ury.base]<\\n[pdf:ury] .nr pdf:ury.base +1v
1326    .   nr pdf:ury.base -1m+\\n[PDFHREF.LEADING]
1327    .   \"
1328    .   \" adjust the end-point vertical displacement by the same offset,
1329    .   \" and then relocate the link starting point to its new displacement,
1330    .   \" as established by this base line relative computation.
1331    .   \"
1332    .   nr pdf:lly.end +\\n[pdf:ury.base]-\\n[pdf:ury]+\\*[PDFHREF.HEIGHT]
1333    .   rnn pdf:ury.base pdf:ury
1334    .   \}
1335    .if \\$1<2 \{\
1336    .   \"
1337    .   \" Link segment fits on a single line ...
1338    .   \" Set its height and end-point horizontal displacement accordingly.
1339    .   \"
1340    .   nr pdf:lly \\n[pdf:ury]+\\*[PDFHREF.HEIGHT]
1341    .   if \\n[pdf:lly]>=\\n[pdf:lly.end] .nr pdf:urx \\$2
1342    .   \}
1343  .ie \\$1=3 \{\  .ie \\$1=3 \{\
1344    .   \"
1345    .   \" Link segment extends beyond the next page break ...
1346    .   \" Recompute truncated height, to just fit portion on current page,
1347    .   \" recursing to emit it, and leaving page trap mechanism to place
1348    .   \" continuation region(s) on following page(s).
1349    .   \"
1350  .   nr pdf:lly (\\n[.t]u-\\n[.V]u)/1v  .   nr pdf:lly (\\n[.t]u-\\n[.V]u)/1v
1351  .   if \\n[pdf:lly]>0 \{\  .   if \\n[pdf:lly]>0 \{\
1352  .      nr pdf:lly \\n[pdf:ury]+\\n[pdf:lly]v-1v+\\*[PDFHREF.HEIGHT]  .      nr pdf:lly \\n[pdf:ury]+\\n[pdf:lly]v-1v+\\*[PDFHREF.HEIGHT]
1353  .      pdf*href.mark.emit 2  .      pdf*href.mark.emit 2
1354  .      \}  .      \}
1355  .   \}  .   \}
1356  .el .pdfmark \\*[pdf:href.link] /Rect [\\*[pdf:bbox]] /ANN  .el \{\
1357  ..  .   \" Link region size and placement has been fully specified ...
1358  .de pdf*href.mark.release  .   \" Emit it.
 .als pdf*href.mark.end pdf*href.mark.close  
 .als pdf*href.mark.hook pdf*href.mark.idle  
 .\"  
 .\" Before finalising this link, check if its active region  
 .\" extends beyond the first line of text on its last page.  
 .\"  
 .mk pdf:lly  
 .ie \\n[pdf:lly]>\\n[pdf:ury] \{\  
 .   \"  
 .   \" When more than one line of link text overflows to a  
 .   \" new page, then we need to compute an extra active region  
 .   \" which will cover all but the last line of link text.  
 .   \"  
 .   nr pdf:lly +\\n[pdf:ury.trim]+\\n(.V-\\n[pdf:ury]  
 .   nr pdf:lly \\n[pdf:lly]/1v*1v-1v+\\*[PDFHREF.HEIGHT]+\\n[pdf:ury]  
 .   pdf*href.mark.emit 2  
 .   nr pdf:ury \\n[pdf:lly]-\\*[PDFHREF.HEIGHT]+1v  
 .   \"  
 .   \" Now, retrieve the page co-ordinates  
 .   \" for the end of the link text  
1359  .   \"  .   \"
1360  .   pdf*href.map.read urx lly  .   pdfmark \\*[pdf:href.link] /Rect [\\*[pdf:bbox]] /ANN
1361  .   \}  .   \}
 .el \{\  
 .   \" When the link text "overflow" occupies only a portion of  
 .   \" the first line on its final page, then we need to compute  
 .   \" the page co-ordinates for its upper right corner.  
 .   \"  
 .   pdf*href.map.read urx ury  
 .   nr pdf:ury -\\n[PDFHREF.LEADING]  
 .   \}  
 .\" Finally, on the last line of the reference,  
 .\" define the "hot-spot" region to cover the portion of the  
 .\" link, from start of line to the end of the link text.  
 .\"  
 .pdf*href.mark.emit 0  
 .pdf*href.mark.flush  
 ..  
 .de pdf*href.mark.flush  
 .rr pdf:spg pdf:llx pdf:lly pdf:urx pdf:ury pdf:ury.trim pdf:epg  
 .if dPDFHREF.COLOR .als PDFHREF.COLOUR PDFHREF.COLOR  
 ..  
 .de pdf*href.mark.close  
 .ie '\\n(.z'' .pdf*href.mark.flush  
 .el \!.pdf*href.mark.end  
 ..  
 .de pdf*href.mark.end  
 \O1|\h'-\w"|"u'\O2\c  
1362  ..  ..
1363  .\"  .\"
1364  .\" When "pdf*href" emits a link for which the "hot-spot" spans a  .\" When "pdf*href" emits a link for which the "hot-spot" spans a
# Line 1390  inspiration has come from discussion on Line 1392  inspiration has come from discussion on
1392  .\" ----------------------------------------------------------------------  .\" ----------------------------------------------------------------------
1393  .\"  .\"
1394  .mk pdf:ury  .mk pdf:ury
1395  .nr pdf:ury +\\n[pdf:ury.trim]  .nr pdf:ury +1v-1m-\\n[PDFHREF.LEADING]
1396  .if \\n-[pdf:epg] .pdf*href.mark.emit 3  .ie \\n-[pdf:epg] \{\
1397    .   \"
1398    .   \" The link "hot-spot" extends across more than one page break,
1399    .   \" so, for each page which is completely contained within the
1400    .   \" extent of the link, simply mark the entire text area on the
1401    .   \" page as a "hot-spot".
1402    .   \"
1403    .   pdf*href.mark.emit 3
1404    .   \}
1405    .el \{\
1406    .   \" The link "hot-spot" ends on the page which immediately follows
1407    .   \" the current page transition, so we may now finalise this link.
1408    .   \"
1409    .   nr pdf:lly \\n[pdf:ury]+\\*[PDFHREF.HEIGHT]
1410    .   if \\n[pdf:lly.end]>\\n[pdf:lly] \{\
1411    .      \"
1412    .      \" The "hot-spot" extends beyond the first line of text,
1413    .      \" on its final page; compute and emit "hot-spot" region to cover
1414    .      \" the full with of the text area, including all but the last
1415    .      \" line of the link text.
1416    .      \"
1417    .      while \\n[pdf:lly.end]>\\n[pdf:lly] .nr pdf:lly +1v
1418    .      nr pdf:lly -1v
1419    .      pdf*href.mark.emit 2
1420    .      \"
1421    .      \" Now, adjust the vertical "hot-spot" mapping reference,
1422    .      \" to identify the correct position for the the last line of
1423    .      \" text, over which the "hot-spot" extends.
1424    .      \"
1425    .      nr pdf:ury \\n[pdf:lly.end]-\\*[PDFHREF.HEIGHT]
1426    .      \}
1427    .   \"
1428    .   \" We now have exactly one final line of text, over which we must
1429    .   \" emit a "hot-spot" region;  map it, terminate page trap processing
1430    .   \" for this "hot-spot", and clean up the "hot-spot" mapping context.
1431    .   \"
1432    .   pdf*href.mark.emit 0 \\n[pdf:urx.end]
1433    .   als pdf*href.mark.hook pdf*href.mark.idle
1434    .   pdf*href.mark.flush
1435    .   \}
1436    ..
1437    .de pdf*href.mark.flush
1438    .\" ----------------------------------------------------------------------
1439    .\" ----------------------------------------------------------------------
1440    .rr pdf:spg pdf:epg
1441    .rr pdf:llx pdf:lly pdf:urx pdf:ury
1442    .if dPDFHREF.COLOR .als PDFHREF.COLOUR PDFHREF.COLOR
1443    .rr pdf:urx.end pdf:lly.end
1444    ..
1445    .de pdf*href.mark.end
1446    .\" ----------------------------------------------------------------------
1447    .\" ----------------------------------------------------------------------
1448    \O1|\h'-\w"|"u'\O2\c
1449  ..  ..
1450  .\" Macro "pdf*href-I" is used for one time initialisation of special  .\" Macro "pdf*href-I" is used for one time initialisation of special
1451  .\" "pdfhref" features; (currently, only the above page trap hook is  .\" "pdfhref" features; (currently, only the above page trap hook is

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26