[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: Form (5fd7a6d)
Ulrike Fischer
fischer at troubleshooting-tex.de
Mon Sep 2 18:56:12 CEST 2019
Repository : https://github.com/latex3/pdfresources
On branch : backendtest
Link : https://github.com/latex3/pdfresources/commit/5fd7a6d4f249894540ac57dfaf72a87d38c6961e
>---------------------------------------------------------------
commit 5fd7a6d4f249894540ac57dfaf72a87d38c6961e
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Mon Sep 2 18:56:12 2019 +0200
Form
>---------------------------------------------------------------
5fd7a6d4f249894540ac57dfaf72a87d38c6961e
hluatex-experimental.def | 78 +++++++++++++++++----------------
pdfresources.dtx | 0
testfiles-pool/calculationsortorder.pvt | 40 +----------------
3 files changed, 43 insertions(+), 75 deletions(-)
diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index 7bf437a..a8aae69 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -838,17 +838,15 @@
}
\ExplSyntaxOff
%%% UF removed old atbegshi fix
-
-%\def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
-% \Hy at Message{Sorry, pdftex does not support FORM gauges}%
-%}
-
\ExplSyntaxOn
\def\MakeFieldObject#1#2
{
\pdf_xform_new:nnnn { #2 }{}{} { #1 }
}%
+\prop_new:N \g__hyp_AcroForm_CoFields_prop
+\prop_new:N \g__hyp_AcroForm_Fields_prop
+\seq_new:N \l__hyp_tmpa_seq
\let\HyField at afields\ltx at empty
\let\HyField at cofields\ltx at empty
%% UF test for old pdftex removed
@@ -856,17 +854,18 @@
%\let\HyField at AuxAddToCoFields\ltx at gobbletwo
\def\HyField at AfterAuxOpen{\Hy at AtBeginDocument}%
-\prop_new:N \g_hyp_AcroForm_CoFields_prop
-\prop_new:N \g_hyp_AcroForm_Fields_prop
+% the value doesn't matter, but with a prop we avoid duplicates and it is
+% clearly faster than removing them from a sequence
\def\HyField at AuxAddToFields#1
{
- %\pdf_catalog_gput:nx { AcroForm/Fields}{ #1 }
- \prop_gput:Nnn \g_hyp_AcroForm_Fields_prop {#1}{F}
+ \prop_gput:Nnn \g__hyp_AcroForm_Fields_prop {#1}{F}
}%
+%fields with empty key get a value too -- lets hope that
+%this give the expected behaviour
\def\HyField at AuxAddToCoFields #1 #2
{
- \prop_gput:Nnn \g_hyp_AcroForm_CoFields_prop {a#1}{#2}
+ \prop_gput:Nnn \g__hyp_AcroForm_CoFields_prop {a#1}{#2}
}
\Hy at AtBeginDocument
@@ -902,7 +901,7 @@
\Fld at calculate@sortkey
}
{
- \pdf_link_last:
+ \pdf_link_last:
}
}
\fi
@@ -931,41 +930,46 @@
\pdf at ifdraftmode{}
{
\Hy at FormObjects
- \tl_if_empty:NF\HyField at cofields
- {
- \show\HyField at cofields
- %\pdf_object_new:nn { l__hyp_acroform/co_obj } {array}
- %\pdf_catalog_gput:nn {AcroForm/CO}{ l__hyp_acroform/co_obj }
- }
-
- \pdf_object_new:nn { l__hyp_acroform/dr/font_obj }{dict}
+ \prop_map_inline:Nn \g__hyp_AcroForm_Fields_prop
+ {
+ \pdf_catalog_gput:nn {AcroForm/Fields}{##1}
+ }
+ \prop_if_empty:NF \g__hyp_AcroForm_CoFields_prop
+ {
+ \prop_map_inline:Nn \g__hyp_AcroForm_CoFields_prop
+ {
+ \seq_put_right:Nn \l__hyp_tmpa_seq {##1}
+ }
+ \seq_sort:Nn \l__hyp_tmpa_seq
+ {
+ \int_compare:nNnTF { \pdf at strcmp{##1}{##2} } > { 0 }
+ %\int_compare:nNnTF { \__str_if_eq:nn {#1}{#2} } > { 0 }
+ { \sort_return_swapped: }
+ { \sort_return_same: }
+ }
+ \seq_map_inline:Nn \l__hyp_tmpa_seq
+ {
+ \pdf_catalog_gput:nx
+ {AcroForm/CO}
+ {
+ \prop_item:Nn \g__hyp_AcroForm_CoFields_prop {##1}
+ }
+ }
+ }
+ \pdf_catalog_gput:nx
+ { AcroForm/DR/Font }
+ { {ZaDb} {\pdf_object_ref:n {l__hyp_font_zapfdingbats_obj} } }
\pdf_catalog_gput:nx
{ AcroForm/DR/Font }
- { \pdf_object_ref:n {l__hyp_acroform/dr/font_obj} }
+ { {Helv} {\pdf_object_ref:n {l__hyp_font_helvetica_obj} } }
\pdf_catalog_gput:nn {AcroForm}{{DA}{(/Helv~10~Tf~0~g)}}
- %\ifHy at pdfa %???????
- \legacy_if:nF { Hy at pdfa }
+ \legacy_if:nF { Hy at pdfa } %?????? Standards?
{
\legacy_if:nT { HyField at NeedAppearances }
{
\pdf_catalog_gput:nn {AcroForm}{{NeedAppearances}{true}}
}
}
- \AtEndDocument
- {
- \pdf_object_write:nx
- { l__hyp_acroform/fields_obj }
- { \HyField at afields }
- \tl_if_empty:NF \HyField at cofields
- {
- %\pdf_object_write:nx { l__hyp_acroform/co_obj } {\romannumeral-`\Q\HyField at cofields}
- }
- \pdf_object_write:nx { l__hyp_acroform/dr/font_obj }
- {
- /ZaDb~\pdf_object_ref:n {l__hyp_font_zapfdingbats_obj}~
- /Helv~\pdf_object_ref:n {l__hyp_font_helvetica_obj}
- }
- }
}
\MakeFieldObject
{
diff --git a/testfiles-pool/calculationsortorder.pvt b/testfiles-pool/calculationsortorder.pvt
index d2e6f58..e96f61f 100644
--- a/testfiles-pool/calculationsortorder.pvt
+++ b/testfiles-pool/calculationsortorder.pvt
@@ -5,46 +5,10 @@
{hyperref}
\ExplSyntaxOn
\pdf_uncompress:
-%\makeatletter\def\HyField at ABD@AuxAddToCoFields#1#2{%
-% \group_begin:
-% \Hy at safe@activestrue
-% \let\ltx at secondoftwo\relax
-% \ifx\HyField at cofields\ltx at empty
-% \xdef\HyField at cofields{%
-% \ltx at secondoftwo{#1}{~#2}%
-% } \show\HyField at cofields
-% \else
-% \let\ltx at secondoftwo\relax
-% \def\HyField at AddCoField##1##2##3{%
-% \ifx##1\ltx at empty
-% \ltx at secondoftwo{#1}{~#2}%
-% \expandafter\ltx at gobble
-% \else
-% \ifnum\pdf at strcmp{##2}{#1}>\ltx at zero
-% \ltx at secondoftwo{#1}{~#2}%
-% \ltx at secondoftwo{##2}{##3}%
-% \expandafter\expandafter\expandafter\ltx at gobble
-% \else
-% \ltx at secondoftwo{##2}{##3}%
-% \fi
-% \fi
-% %\show\HyField at AddCoField
-% \HyField at AddCoField
-% }%
-% \xdef\HyField at cofields{%
-% \expandafter\HyField at AddCoField
-% \HyField at cofields\ltx at empty\ltx at empty\ltx at empty
-% }%
-% \show\HyField at cofields
-% \fi
-% \group_end:
-% }%
-%\makeatother
+
\ExplSyntaxOff
\begin{document}
-\ExplSyntaxOn
-\prop_show:N\g_hyp_AcroForm_CoFields_prop
-\ExplSyntaxOff
+
\begin{Form}
\TextField[
maxlen=40,
More information about the latex3-commits
mailing list