summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-03-11 20:26:44 +0000
committerKarl Berry <karl@freefriends.org>2015-03-11 20:26:44 +0000
commit0ee8c6accf9cf3c2053bac3be27d24021c30e870 (patch)
tree8e37e2fd44aa4f437a048dd55f830f677ef80db9
parent35a44d74c4bca55917174dec070b96fc0111fca2 (diff)
fixocgx (11mar15)
git-svn-id: svn://tug.org/texlive/trunk@36487 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/fixocgx/ChangeLog9
-rw-r--r--Master/texmf-dist/doc/latex/fixocgx/README2
-rw-r--r--Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty56
3 files changed, 60 insertions, 7 deletions
diff --git a/Master/texmf-dist/doc/latex/fixocgx/ChangeLog b/Master/texmf-dist/doc/latex/fixocgx/ChangeLog
index 309d0ed3b3b..da783c302b1 100644
--- a/Master/texmf-dist/doc/latex/fixocgx/ChangeLog
+++ b/Master/texmf-dist/doc/latex/fixocgx/ChangeLog
@@ -1,3 +1,12 @@
+2015-03-11
+ * v0.3
+ * New: ocg environment option `viewocg=always|never|ifvisible' added;
+ macro \fxocg@insert@OC allows package authors to insert
+ /OC <<OCMD with currently open OCGs>> entries into (suitable) pdf objects,
+ i. e. XObjects & Annotations, to make them PDF-layer aware.
+ * Fix: dead tikz-generated ocg buttons (from tikzlibraryocgx.code.tex) with
+ dvipdfmx/xelatex
+
2015-01-26
* v0.2
* Fix: It was not possible to reference an OCG before defining it.
diff --git a/Master/texmf-dist/doc/latex/fixocgx/README b/Master/texmf-dist/doc/latex/fixocgx/README
index f1cf698d995..3427b7f2ccd 100644
--- a/Master/texmf-dist/doc/latex/fixocgx/README
+++ b/Master/texmf-dist/doc/latex/fixocgx/README
@@ -1,7 +1,7 @@
==================================
The `fixocgx' LaTeX Package
- Version 0.2 [2015/01/26]
+ Version 0.3 [2015/03/10]
(C) 2015--\today Alexander Grahn
==================================
diff --git a/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty b/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty
index f305990370e..44dde61b675 100644
--- a/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty
+++ b/Master/texmf-dist/tex/latex/fixocgx/fixocgx.sty
@@ -45,7 +45,7 @@
}
}
-\ProvidesExplPackage{fixocgx}{2015/01/26}{0.2}
+\ProvidesExplPackage{fixocgx}{2015/03/11}{0.3}
{ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
%re-implement ocg-p's `ocg' environment
@@ -64,7 +64,7 @@
\tl_gset:cn{fxocg@#3.opts}{#1}
\setkeys[ocgp]{ocg}{#1}
\mix_pdfobj:nnn{}{dict}{
- /Type/OCG/Name~(#2)/Usage<<\@ocgp@print\@ocgp@export>>
+ /Type/OCG/Name~(#2)/Usage<<\l_fxocg_view_tl\@ocgp@print\@ocgp@export>>
}
\tl_gput_right:Nx\@ocgbase@ocgs{\space\g_mix_pdflastobj_tl}
\int_compare:nT{#4==\c_zero}{
@@ -89,12 +89,14 @@
}
}
\tl_gset:cx{OCGpdfobj#3}{\use:c{fxocg@#3}}
+ \seq_gput_left:Nx\g_fixocg_ocgstack_seq{\use:c{fxocg@#3}}
\group_end:
\mix_pdfbdc:nn{/OC}{\use:c{fxocg@#3}}
\ignorespaces
}{
\unskip
\mix_pdfemc:
+ \seq_gpop_left:NN\g_fixocg_ocgstack_seq\l_tempa_tl
\bool_if:NT\g_fxocg_nestedE_bool{\tl_gput_right:Nx\@ocgbase@ocgorder{~]}}
\bool_gset_true:N\g_fxocg_nestedE_bool
\bool_gset_false:N\g_fxocg_nestedB_bool
@@ -102,6 +104,34 @@
\bool_new:N\g_fxocg_nestedB_bool % nested OCG begin
\bool_new:N\g_fxocg_nestedE_bool % nested OCG end
+%stack of PDF obj references of currently open OCGs
+\seq_new:N\g_fixocg_ocgstack_seq
+%macro that inserts /OC <<OCMD with currently open OCGs>> entry;
+%for use within annotation dicts
+\tl_set:Nn\fxocg@insert@OC{
+ \seq_if_empty:NF\g_fixocg_ocgstack_seq{
+ /OC~<</Type/OCMD/OCGs~[\seq_use:Nn\g_fixocg_ocgstack_seq{~}]/P/AllOn>>
+ }
+}
+
+%workaround for ocg buttons (from tikzlibraryocgx.code.tex)
+%with dvipdfmx and xelatex
+\cs_set:Nn\fxocg_pdflink:nn{
+ \bool_if:nTF{
+ \g_mix_dvipdfmx_bool && \cs_if_exist_p:N\pgfpictureid
+ }{
+ \hbox_set:Nn\l_tmpa_box{#2}
+ \mix_pdfannot:nnnn{
+ \dim_use:N\box_wd:N\l_tmpa_box}{
+ \dim_use:N\box_ht:N\l_tmpa_box}{
+ \dim_use:N\box_dp:N\l_tmpa_box
+ }{#1}
+ \box_use_clear:N\l_tmpa_box
+ }{
+ \mix_pdflink:nn{#1}{#2}
+ }
+}
+
%re-implement commands from ocgx.sty (all engines including ps2pdf [gs>=9.15])
\long\def\switchocg#1#2{
\tl_set:Nn\l_fxocg_ocglist_tl{}
@@ -110,7 +140,7 @@
\fxocg_process_ocgref:NN\l_fxocg_ocglist_tl\l_tempa_tl
}
\leavevmode
- \mix_pdflink:nn{
+ \fxocg_pdflink:nn{
/Subtype/Link
/A <</S/SetOCGState /State [/Toggle~\l_fxocg_ocglist_tl]>>
/Border [0~0~0]
@@ -124,7 +154,7 @@
\fxocg_process_ocgref:NN\l_fxocg_ocglist_tl\l_tempa_tl
}
\leavevmode
- \mix_pdflink:nn{
+ \fxocg_pdflink:nn{
/Subtype/Link
/A <</S/SetOCGState/State [/ON~\l_fxocg_ocglist_tl]>>
/Border [0~0~0]
@@ -138,7 +168,7 @@
\fxocg_process_ocgref:NN\l_fxocg_ocglist_tl\l_tempa_tl
}
\leavevmode
- \mix_pdflink:nn{
+ \fxocg_pdflink:nn{
/Subtype/Link
/A <</S/SetOCGState/State [/OFF~\l_fxocg_ocglist_tl]>>
/Border [0~0~0]
@@ -162,7 +192,7 @@
\fxocg_process_ocgref:NN\l_fxocg_tohide_tl\l_tempa_tl
}
\leavevmode
- \mix_pdflink:nn{
+ \fxocg_pdflink:nn{
/Subtype/Link
/A <</S/SetOCGState
/State [
@@ -184,6 +214,17 @@
}
}
+\define@choicekey*[ocgp]{ocg}{viewocg}[\l_fxocg_viewbin_tl\l_fxocg_viewno_tl]{always,never,ifvisible}[ifvisible]{%
+ \if_case:w\l_fxocg_viewno_tl
+ \def\l_fxocg_view_tl{/View<</ViewState/ON>>}
+ \or:%
+ \def\l_fxocg_view_tl{/View<</ViewState/OFF>>}
+ \or:
+ \def\l_fxocg_view_tl{}
+ \fi:
+}
+\presetkeys[ocgp]{ocg}{viewocg=ifvisible,printocg=ifvisible,exportocg=ifvisible,listintoolbar=iffirstuse}{}
+
\group_begin:
\char_set_catcode_active:N\+\let+\space
\tl_gset:Nx\g_fxocg_gsoldwarning_tl{
@@ -218,3 +259,6 @@
Line~\msg_line_number: :~OCG~`#1'~is~not~defined.
}
\msg_set:nnn{fixocgx}{undefined~OCGs}{There~were~undefined~OCGs!}
+
+%prevent ocg-p from inserting PS specials in dvipdfmx mode
+\bool_if:NF\g_mix_dvipdfmx_bool{\@ocgp@ifpsfalse}