[latex3-commits] [git/LaTeX3-latex3-pdfresources] textfields: storing (1e0adb0)
Ulrike Fischer
fischer at troubleshooting-tex.de
Tue Apr 6 00:24:08 CEST 2021
Repository : https://github.com/latex3/pdfresources
On branch : textfields
Link : https://github.com/latex3/pdfresources/commit/1e0adb068722636867f289fa8a333e777d865a39
>---------------------------------------------------------------
commit 1e0adb068722636867f289fa8a333e777d865a39
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Tue Apr 6 00:24:08 2021 +0200
storing
>---------------------------------------------------------------
1e0adb068722636867f289fa8a333e777d865a39
experiments/testfield1.tex | 41 ++++++++++++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 11 deletions(-)
diff --git a/experiments/testfield1.tex b/experiments/testfield1.tex
index 1b481c4..86f90a5 100644
--- a/experiments/testfield1.tex
+++ b/experiments/testfield1.tex
@@ -7,24 +7,29 @@
\usepackage{hyperref}
\ExplSyntaxOn
-% color command, copied from hgeneric, should perhaps be defined somewhere else
-\cs_new_protected:Npn \__pdffield_color_export:nnN #1 #2 #3
+% color command, adapted from hgeneric, should perhaps be defined somewhere else
+\str_new:N \l_pdffield_colormodel_str
+\str_set:Nn \l_pdffield_colormodel_str {rgb}
+
+\cs_new_protected:Npn \__pdffield_color_export:nN #1 #2
{
\tl_if_head_eq_charcode:nNTF {#1}[ %]
{
- \__pdffield_color_export:wnnN #1 {#2} #3
+ \__pdffield_color_export:wnN #1 #2
}
{
- \color_export:nnN {#1} {#2} #3
+ \exp_args:Nnx
+ \color_export:nnN {#1} {space-sep-\l_pdffield_colormodel_str} #2
}
}
-\cs_new_protected:Npn \__pdffield_color_export:wnnN [#1] #2 #3 #4
+\cs_new_protected:Npn \__pdffield_color_export:wnN [#1] #2 #3
{
- \color_export:nnnN {#1}{#2}{#3}#4
+ \exp_args:Nnnx
+ \color_export:nnnN {#1}{#2}{space-sep-\l_pdffield_colormodel_str}#3
}
-\cs_generate_variant:Nn \__pdffield_color_export:nnN {xVN}
+%\cs_generate_variant:Nn \__pdffield_color_export:nN {xVN}
\pdfdict_new:n {l__pdffield/text/field}
@@ -261,16 +266,29 @@
align .initial:n = left,
color .code:n =
{
- \color_export:nnN {#1}{ space-sep-rgb} \l__pdffield_text_color_tl
- \tl_put_right:Nn \l__pdffield_text_color_tl{~rg}
+ \__pdffield_color_export:nN {#1} \l__pdffield_text_color_tl
+ \str_case:Vn \l_pdffield_colormodel_str
+ {
+ {rgb} {\tl_put_right:Nn \l__pdffield_text_color_tl{~rg}}
+ {cmyk}{\tl_put_right:Nn \l__pdffield_text_color_tl{~k}}
+ }
},
color .initial:n = black,
bordercolor .code:n =
{
- \color_export:nnN {#1}{ space-sep-rgb} \l__pdffield_tmpa_tl
+ \__pdffield_color_export:nN {#1} \l__pdffield_tmpa_tl
\pdfdict_put:nnx {l__pdffield/text/annot/MK}{BC}{[\l__pdffield_tmpa_tl]}
},
-
+ backgroundcolor .code:n =
+ {
+ \__pdffield_color_export:nN {#1} \l__pdffield_tmpa_tl
+ \pdfdict_put:nnx {l__pdffield/text/annot/MK}{BG}{[\l__pdffield_tmpa_tl]}
+ },
+ backgroundcolor .code:n =
+ {
+ \__pdffield_color_export:nN {#1} \l__pdffield_tmpa_tl
+ \pdfdict_put:nnx {l__pdffield/text/annot/MK}{BG}{[\l__pdffield_tmpa_tl]}
+ },
}
@@ -351,6 +369,7 @@
%\setmainfont{lmroman10-regular.otf} %replaced by arial CIDFontType0
\begin{document}
\ExplSyntaxOn
+avb \sffamily abc
\__pdffield_text_add:n {width=4cm,name=default,height=\baselineskip}
More information about the latex3-commits
mailing list.