diff options
Diffstat (limited to 'macros/latex/contrib/tagpdf/tagpdf-space-code.sty')
-rw-r--r-- | macros/latex/contrib/tagpdf/tagpdf-space-code.sty | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/macros/latex/contrib/tagpdf/tagpdf-space-code.sty b/macros/latex/contrib/tagpdf/tagpdf-space-code.sty new file mode 100644 index 0000000000..c47da0e73d --- /dev/null +++ b/macros/latex/contrib/tagpdf/tagpdf-space-code.sty @@ -0,0 +1,45 @@ +\ProvidesExplPackage {tagpdf-space-code} {2019/07/02} {0.61} + {part of tagpdf - code related to real space chars} +% luatex uses an attribute (declared in the driver file) and some luacode in tagpdf.lua +% perhaps I will split the code by engine in the future + +\sys_if_engine_pdftex:T +{ + \pdfglyphtounicode{space}{0020} + \keys_define:nn { uftag / setup } + { + interwordspace .choices:nn = { true, on } { \pdfinterwordspaceon }, + interwordspace .choices:nn = { false, off }{ \pdfinterwordspaceon }, + show-spaces .bool_set:N = \l__uftag_showspaces_bool + } + +} + + +\sys_if_engine_luatex:T +{ + \keys_define:nn { uftag / setup } + { + interwordspace .choices:nn = { true, on } + { \directlua{uftag.func.markspaceon()} }, + + interwordspace .choices:nn = { false, off } + {\directlua{uftag.func.markspaceoff()} }, + show-spaces .choice:, + show-spaces / true .code:n = {\directlua{uftag.trace.showspaces=true}}, + show-spaces / false .code:n = {\directlua{uftag.trace.showspaces=nil}}, + show-spaces .default:n = true + } + \cs_new_protected:Nn \__uftag_fakespace: + { + \group_begin: + \setattribute\g__uftag_interwordspace_attr{1} + \setattribute\g__uftag_interwordfont_attr{\directlua{tex.print(\the\catcodetable@latex, font.current())}} + \skip_horizontal:n{\c_zero_skip} + \group_end: + } +} + + + +\endinput |