1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
% \iffalse meta-comment
%
%% File: tagpdf-space.dtx
%
% Copyright (C) 2019-2023 Ulrike Fischer
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version. The latest version
% of this license is in the file
%
% https://www.latex-project.org/lppl.txt
%
% This file is part of the "tagpdf bundle" (The Work in LPPL)
% and all files in that bundle must be distributed together.
%
% -----------------------------------------------------------------------
%
% The development version of the bundle can be found at
%
% https://github.com/u-fischer/tagpdf
%
% for those people who are interested.
%<*driver>
\DocumentMetadata{}
\documentclass{l3doc}
\usepackage{array,booktabs,caption}
\hypersetup{pdfauthor=Ulrike Fischer,
pdftitle=tagpdf-space module (tagpdf)}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
% \title{^^A
% The \pkg{tagpdf-space} module\\ Code related to real space chars ^^A
% \\ Part of the tagpdf package
% }
%
% \author{^^A
% Ulrike Fischer\thanks
% {^^A
% E-mail:
% \href{mailto:fischer@troubleshooting-tex.de}
% {fischer@troubleshooting-tex.de}^^A
% }^^A
% }
%
% \date{Version 0.98j, released 2023-07-08}
% \maketitle
% \begin{documentation}
% \begin{function}{interwordspace (setup-key)}
% This key allows to activate/deactivate the real space chars if the engine supports
% it. The allowed values are |true|, |on|, |false|, |off|.
% \end{function}
% \begin{function}{show-spaces (setup-key)}
% This key works only with luatex and shows with small red
% bars where spaces have been inserted. This is only for debugging and
% is not completly reliable (and change affect other literals and tagging), so it
% should be used with care.
% \end{function}
% \end{documentation}
% \begin{implementation}
% \begin{macrocode}
%<@@=tag>
%<*header>
\ProvidesExplPackage {tagpdf-space-code} {2023-07-08} {0.98j}
{part of tagpdf - code related to real space chars}
%</header>
% \end{macrocode}
% \section{Code for interword spaces}
% The code is engine/backend dependant. Basically only pdftex and luatex
% support real space chars. Most of the code for luatex which uses attributes
% is in the lua code, here are only the keys.
%
% \begin{macro}{interwordspace (setup-key),show-spaces (setup-key)}
% \begin{macrocode}
%<*package>
\keys_define:nn { @@ / setup }
{
interwordspace .choices:nn = { true, on }
{ \msg_warning:nnx {tag}{sys-no-interwordspace}{\c_sys_engine_str} },
interwordspace .choices:nn = { false, off }
{ \msg_warning:nnx {tag}{sys-no-interwordspace}{\c_sys_engine_str} },
interwordspace .default:n = true,
show-spaces .bool_set:N = \l_@@_showspaces_bool
}
\sys_if_engine_pdftex:T
{
\sys_if_output_pdf:TF
{
\pdfglyphtounicode{space}{0020}
\keys_define:nn { @@ / setup }
{
interwordspace .choices:nn = { true, on } { \pdfinterwordspaceon },
interwordspace .choices:nn = { false, off }{ \pdfinterwordspaceon },
interwordspace .default:n = true,
show-spaces .bool_set:N = \l_@@_showspaces_bool
}
}
{
\keys_define:nn { @@ / setup }
{
interwordspace .choices:nn = { true, on, false, off }
{ \msg_warning:nnn {tag}{sys-no-interwordspace}{dvi} },
interwordspace .default:n = true,
show-spaces .bool_set:N = \l_@@_showspaces_bool
}
}
}
\sys_if_engine_luatex:T
{
\keys_define:nn { @@ / setup }
{
interwordspace .choices:nn =
{ true, on }
{
\bool_gset_true:N \g_@@_active_space_bool
\lua_now:e{ltx.@@.func.markspaceon()}
},
interwordspace .choices:nn =
{ false, off }
{
\bool_gset_false:N \g_@@_active_space_bool
\lua_now:e{ltx.@@.func.markspaceoff()}
},
interwordspace .default:n = true,
show-spaces .choice:,
show-spaces / true .code:n =
{\lua_now:e{ltx.@@.trace.showspaces=true}},
show-spaces / false .code:n =
{\lua_now:e{ltx.@@.trace.showspaces=nil}},
show-spaces .default:n = true
}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_fakespace:}
% For luatex we need a command for the fake space as equivalent of the pdftex
% primitive.
% \begin{macrocode}
\sys_if_engine_luatex:T
{
\cs_new_protected:Nn \@@_fakespace:
{
\group_begin:
\lua_now:e{ltx.@@.func.fakespace()}
\skip_horizontal:n{\c_zero_skip}
\group_end:
}
}
%</package>
% \end{macrocode}
% \end{macro}
% \end{implementation}
% \PrintIndex
|