[latex3-commits] [git/LaTeX3-latex3-pdfresources] renamedict77: testing bitset (7fed36c)

Ulrike Fischer fischer at troubleshooting-tex.de
Wed Apr 29 19:11:01 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : renamedict77
Link       : https://github.com/latex3/pdfresources/commit/7fed36c3f5bc1aabe3be5bdbd056197cbcff846f

>---------------------------------------------------------------

commit 7fed36c3f5bc1aabe3be5bdbd056197cbcff846f
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed Apr 29 19:11:01 2020 +0200

    testing bitset


>---------------------------------------------------------------

7fed36c3f5bc1aabe3be5bdbd056197cbcff846f
 experiments/new-attachfile.tex |  39 +++++++++++++++-
 newpackages/atfi-generic.def   |  25 ++++++----
 newpackages/new-attachfile.sty | 102 +++++++++++++++++++++--------------------
 3 files changed, 104 insertions(+), 62 deletions(-)

diff --git a/experiments/new-attachfile.tex b/experiments/new-attachfile.tex
index bbb24a4..ef2822c 100644
--- a/experiments/new-attachfile.tex
+++ b/experiments/new-attachfile.tex
@@ -2,7 +2,7 @@
 \documentclass{article}
 \usepackage{xcolor}
 \usepackage[customdriver=hgeneric-experimental]{hyperref}
-\usepackage{new-attachfile,l3draw,l3color}
+\usepackage{new-attachfile,l3draw,l3color,bitset}
 \ExplSyntaxOn
 \pdf_uncompress:
 \ExplSyntaxOff
@@ -10,9 +10,22 @@
 %t0\attachfilesetup{color=attachfilecolor}
 \begin{document}
 abc
+\ExplSyntaxOn
+\__pdf_backend_xform_if_exist:nTF { atfi at appearancebox }{true}{false}
+\par
+
+\pdf_xform_if_exist:nTF { atfi at appearancebox }{true}{false}
+\ExplSyntaxOff
+
+%\end{document}
+
+
 \attachfile[icon=Graph,mimetype=text/plain]{catalogue.tex} some text
 
-%\attachfile[icon=Paperclip,mimetype=application/x-hdf]{catalogue.tex} some text
+\ExplSyntaxOn
+\pdf_xform_if_exist:nTF { atfi at appearancebox }{true}{false}
+\ExplSyntaxOff
+\attachfile[icon=Paperclip,mimetype=application/x-hdf]{catalogue.tex} some text
 
 %\attachfile[icon=Tag,mimetype=application/x-hdf]{catalogue.tex} some text
 %
@@ -27,6 +40,28 @@ abc
 \atfi at acroTag
 \ExplSyntaxOn
 
+\prop_const_from_keyval:Nn \__pdf_annot_flag_prop:
+ {
+   Invisible = 0,
+   Hidden    = 1,
+   Print     = 2,
+   NoZoom    = 3,
+   NoRotate  = 4,
+   NoView    = 5,
+   ReadOnly  = 6,
+   Locked    = 7,
+   ToggleNoView = 8,
+   LockedContents = 9
+ }
+\bitsetReset {annotFlag}
+
+\bitsetSet{annotFlag}{\prop_item:Nn\__pdf_annot_flag_prop:{Print}}
+
+\bitsetGetDec {annotFlag}\par
+
+\bitsetSet{annotFlag}{\prop_item:Nn\__pdf_annot_flag_prop:{NoZoom}}
+
+\bitsetGetDec {annotFlag}
 \ExplSyntaxOff
 
  \end{document}
diff --git a/newpackages/atfi-generic.def b/newpackages/atfi-generic.def
index 41268ce..ec87098 100644
--- a/newpackages/atfi-generic.def
+++ b/newpackages/atfi-generic.def
@@ -58,20 +58,25 @@
 % we probably need an xform by icon ...
 
 \def\atfi at xform{%
-  \pdf_xform_new:nnn
-  { atfi at appearancebox }
-  { }
-  { \usebox\atfi at appearancebox }
+  \pdf_xform_if_exist:nF { atfi at appearancebox }
+    {
+      \pdf_xform_new:nnn
+        { atfi at appearancebox }
+        { }
+        { \usebox\atfi at appearancebox }
+    }
   %\immediate\pdfxform\atfi at appearancebox
   %\edef\atfi at appearanceobj{\the\pdflastxform}%
 }
-\ExplSyntaxOff
 
-\let\atfi at xform@icon\atfi at xform
-\def\atfi at refxform#1{%
-  \pdfrefxform#1\relax
-}
-\ExplSyntaxOn
+
+%\let\atfi at xform@icon\atfi at xform
+%\def\atfi at refxform#1{%
+%  %\pdf_xform_ref:n { #1 }
+%  \pdf_xform_use:n { atfi at appearancebox }
+%  %\pdfrefxform#1\relax
+%}
+
 \def\atfi at insert@file at annot#1{%
   \rule{0pt}{0pt}%
   \ifatfi at appearance
diff --git a/newpackages/new-attachfile.sty b/newpackages/new-attachfile.sty
index fd1eaca..e4b966e 100644
--- a/newpackages/new-attachfile.sty
+++ b/newpackages/new-attachfile.sty
@@ -1,19 +1,15 @@
 %%
-%% This is file `attachfile2.sty',
+%% This is file `new-attachfile.sty',
 %% generated with the docstrip utility.
 %%
 %% The original source files were:
 %%
-%% attachfile2.dtx  (with options: `package')
 %%
 %% This is a generated file.
 %%
-%% Project: attachfile2
-%% Version: 2019/11/26 v2.11
+%% Project: new-attachfile,
+%% Version: 2020-04-29, 0.1
 %%
-%% Copyright (C)
-%%    2005-2010, 2012  Heiko Oberdiek
-%%    2016-2019  Oberdiek Package Support Group
 %%
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either
@@ -27,20 +23,9 @@
 %%
 %% This work has the LPPL maintenance status "maintained".
 %%
-%% The Current Maintainers of this work are
-%% Heiko Oberdiek and the Oberdiek Package Support Group
-%% https://github.com/ho-tex/attachfile2/issues
-%%
-%%
-%% This work consists of the main source file attachfile2.dtx
-%% and the derived files
-%%    attachfile2.sty, attachfile2.pdf,
-%%    atfi-dvips.def, atfi-pdftex.def, atfi-dvipdfmx.def, atfi-luatex.def
-%%    pdfatfi.pl, pdfatfi.1.
-%%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{new-attachfile}%
-  [2020/04/13 v1.00 Attach files into PDF (HO/UF)]%
+  [2020/04/13 v0.1 Attach files into PDF (HO/UF)]%
 \RequirePackage{pdfresources}
 \RequirePackage{iftex}[2019/11/07]
 \RequirePackage{keyval}
@@ -53,6 +38,8 @@
 \RequirePackage{hyperref}
 \RequirePackage{hycolor}[2008/07/29]
 \RequirePackage{l3color,l3draw,l3pdffile}
+
+
 \ltx at IfUndefined{pdfmatch}{%
   \def\atfi at Match#1#2#3#4#5{}%
 }{%
@@ -82,11 +69,11 @@
       \endgroup
       \expandafter\ltx at firstoftwo
     \else
-      \atfi at Warning{%
-        Internal error: Wrong pattern!\MessageBreak
-        --> #2 <--\MessageBreak
-        Pattern check ignored%
-      }%
+%      \atfi at Warning{%
+%        Internal error: Wrong pattern!\MessageBreak
+%        --> #2 <--\MessageBreak
+%        Pattern check ignored%
+%      }%
       \endgroup
       \expandafter\ltx at firstoftwo
     \fi
@@ -127,34 +114,52 @@
     }%
   }%
 }
-\def\atfi at Warning{\PackageWarning{attachfile2}}
+
+%\def\atfi at Warning{\PackageWarning{new-attachfile}}
+
+
 \SetupKeyvalOptions{%
   family=AtFi,%
   prefix=atfi@%
 }
+
 \def\atfi at setup{\setkeys{AtFi}}
 \DeclareBoolOption{draft}
 \DeclareComplementaryOption{final}{draft}
+
+\ExplSyntaxOn
+\keys_define:nn { atfi }
+  {
+    %mimetype -> embed step
+
+    %icon     -> attach step / setup
+    %         choice? PushPin, Data, Graph,
+    %         initial: PushPin
+
+    %color    -> attach step, affects icon
+    %         decide allowed syntax of expressions ...
+    %         initial: 1 0.9255 0.7765
+
+    %% annotation dict (attach step)
+    %date     /M(...)
+    %         initial  \file_timestamp:n {\jobname.log}
+
+    %annotname /NM (..) (unique name)
+    %          no initial value
+
+    % author  /T (...)
+    %          no initial value
+
+    % description /Contents
+
+    % subject    /Subj
+  }
+\ExplSyntaxOff
 \def\atfi at mimetype{}
 \define at key{AtFi}{mimetype}{%
   \edef\atfi at mimetype{#1}%
-  %fails with allowed types so removing it
- % \ifx\atfi at mimetype\ltx at empty
-%  \else
-%    \atfi at Match\atfi at mimetype{%
-%      ^(application|audio|image|model|text|video|x-\atfi at PatToken)%
-%      /%
-%      ([a-z\-\+_\.0-9]+)%
-%      (; ?\atfi at PatToken=(\atfi at PatToken|\atfi at PatQuotedString))*$%
-%    }{icase}{}{%
-%      \atfi at Warning{%
-%        Invalid value `\atfi at mimetype'\MessageBreak
-%        of option `mimetype'.\MessageBreak
-%        Value is discarded%
-%      }%
-%      \let\atfi at mimetype\ltx at empty
-%    }%
-%  \fi
+  % pattern matching remove as it fails with allowed types
+  %
   \ifx\atfi at mimetype\ltx at empty
   \else
     \EdefEscapeName\atfi at mimetype{\atfi at mimetype}%
@@ -189,15 +194,11 @@
   \numexpr\atfi at time-60*\atfi at hours\relax
 }
 \def\atfi at seconds{0}
+\ExplSyntaxOn
 \def\atfi at date{%
-  /M(D:\the\year
-      \atfi at pad@ii\month
-      \atfi at pad@ii\day
-      \atfi at pad@ii\atfi at hours
-      \atfi at pad@ii\atfi at minutes
-      \atfi at pad@ii\atfi at seconds
-      \atfi at timezone)%
+  /M(\file_timestamp:n{\jobname.log})%
 }
+\ExplSyntaxOff
 \define at key{AtFi}{date}{%
   \EdefEscapeString\atfi at date{#1}%
   \edef\atfi at date{/M(\atfi at date)}%
@@ -765,7 +766,8 @@
     \atfi at set@appearance at icon
     \ifatfi at print
       \expandafter
-      \atfi at refxform\csname atfi at appobj@\atfi at icon@icon\endcsname
+      %\atfi at refxform\csname atfi at appobj@\atfi at icon@icon\endcsname %???
+      \pdf_xform_use:n { atfi at appearancebox } %icon, is use meant here??
     \else
       \makebox[\atfi at appearancewidth]{}%
     \fi





More information about the latex3-commits mailing list.