1%D \module 2%D [ file=scrn-hlt, 3%D version=2024.09.12, 4%D title=\CONTEXT\ Core Macros, 5%D subtitle=PDF Highlights, 6%D author=Hans Hagen, 7%D date=\currentdate, 8%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] 9%C 10%C This module is part of the \CONTEXT\ macro||package and is 11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for 12%C details. 13 14\writestatus{loading}{ConTeXt Interaction Macros / Highlights} 15 16%D This is a fragile feature implemented in abit hackish way, that is: we run on top 17%D of links so thatwe need very little code. Viewers implement the quad points 18%D different from the standard (probably a side effect of acrobat doing it that way: 19%D swapping the third and fourth coordinate). 20%D 21%D We use the PDF namespace so that it's clear that we have some hack. It's mainly 22%D meant for Hraban. 23%D 24%D \starttyping 25%D \enabledirectives[backend.pdf.fixhighlight] 26%D 27%D \definecolor[pdfhighlight:Rhaban][r=.8,g=1,b=1] 28%D \definecolor[pdfhighlight:Hans] [r=1,g=.8,b=1] 29%D \definecolor[pdfhighlight:Ton] [r=1,g=1,b=.8] 30%D 31%D test \PDFhighlight[Rhaban][Who also wants content.]{\samplefile{tufte}} test \blank 32%D test \PDFhighlight[Hans]{what a mess} test \page 33%D test \PDFhighlight[Ton]{\samplefile{tufte}} test \page 34%D \stoptyping 35%D 36%D Currently the directive is needed for Acrobat Reader, Sumatra PDF, Okular, and 37%D maybe more viewers. 38 39%D Tested September 14, 2024 by Mikael & Hans: 40%D 41%D \starttabulate 42%D \NC Firefox \NC follows standard but also works with swapping \NC \NR 43%D \NC EBookDroid \NC follows standard but does something when swapping \NC \NR 44%D \NC Google \NC show nothing \NC \NR 45%D \NC okular \NC swap 3 and 4 \NC \NR 46%D \NC evince \NC swap 3 and 4 \NC \NR 47%D \NC zathura \NC swap 3 and 4 \NC \NR 48%D \NC qpdf \NC swap 3 and 4 \NC \NR 49%D \NC acrobat \NC swap 3 and 4 \NC \NR 50%D \NC sumatra \NC swap 3 and 4, more curved \NC \NR 51%D \stoptabulate 52%D 53%D So, it looks like firefox is doing some analysis on probably the x 54%D coordinates and then accepts a rotated rectangle to misbehave but no 55%D one uses that anyway (the spec could have been 4 numbers plus angle to 56%D save space). 57 58\unprotect 59 60\aliased\let\stopPDFhighlight\relax 61 62\def\strc_references_faked_goto#1[#2]% no test for valid references 63 {\dontleavehmode 64 \begingroup 65 \c_attr_reference\attributeunsetvalue 66 \global\lastsavedreferenceattribute\attributeunsetvalue 67 \iflocation 68 69 %{\referenceprefix}% 70 {}% 71 {#2}% 72 {% 73 height .9\strutht 74 depth .9\strutdp 75 %\extrareferencearguments 76 }% 77 \relax 78 %\setlocationattributes 79 %\setstrut % can be option 80 \global\lastsavedreferenceattribute\lastreferenceattribute 81 \c_attr_reference\lastreferenceattribute 82 %\ifexporting\dostarttaggednodetail\t!link\fi 83 #1% 84 %\ifexporting\dostoptagged\fi 85 \else 86 #1% 87 \fi 88 \endgroup} 89 90\permanent\tolerant\protected\def\startPDFhighlight[#1]#*[#2]#:#3\stopPDFhighlight 91 {\strc_references_faked_goto{#3}[highlight(#1{#2})]} 92 93\permanent\tolerant\protected\def\PDFhighlight[#1]#*[#2]#:#3% 94 {\strc_references_faked_goto{#3}[highlight(#1{#2})]} 95 96\protect 97 |