blob: aa507d7ab7b2094f1f45ddfe545762b27da56feb (
plain)
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
|
%% ---------------------------------------------------------------
%% The typoaid package ---
%% Maintained by Daniele Ratti
%% E-mail: ilfuria+tya@gmail.com
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ---------------------------------------------------------------
\RequirePackage{expl3}
\ProvidesExplPackage{typoaid}{2017/04/21}{0.0.7} {Typographical Aid}
\RequirePackage{xparse}
%%\ExplSyntaxOn
%%\newlength{\typ@@id}
\dim_new:N \l__typoAid_Alphabet_dim
\dim_new:N\l__typoAid_ExHeight_dim
\dim_new:N\l__typoAid_EmWidth_dim
\box_new:N\l__typoAid_Alphabet_box
\str_const:Nx\l__typoAid_typeout_string{TypoAid\iow_newline: *~Font~switch~given:~}
%% abcdefghijklmnopqrstuvwxyz
%%{a{}b{}c{}d{}e{}f{}g{}h{}i{}j{}k{}l{}m{}n{}o{}p{}q{}r{}s{}t{}u{}v{}w{}x{}y{}z{}}
\cs_set_nopar:Npn\_typoAid_typoAlphabet:n #1 {%
\box_gclear:N\l__typoAid_Alphabet_box
\hbox_set:Nn\l__typoAid_Alphabet_box{#1a{}b{}c{}d{}e{}f{}g{}h{}i{}j{}k{}l{}m{}n{}o{}p{}q{}r{}s{}t{}u{}v{}w{}x{}y{}z{}}}
\cs_set_nopar:Npn\_typoAid_incrCntr:n #1 {%
\_typoAid_typoAlphabet:n{#1}
\dim_set:Nn\l__typoAid_Alphabet_dim{\box_wd:N\l__typoAid_Alphabet_box}
}
\cs_set_nopar:Npn\_typoAid_calcEx:n #1{%
\group_begin:
#1
\dim_gset:Nn\l__typoAid_ExHeight_dim{\dim_eval:n{1ex}}
\group_end:
}
\cs_set_nopar:Npn\_typoAid_calcEm:n#1{
\group_begin:
#1
\dim_gset:Nn\l__typoAid_EmWidth_dim{\dim_eval:n{1em}}
\group_end:
}
\cs_set:Npn\_typoAid_log:n#1#2{%
\msg_log:n{%
\l__typoAid_typeout_string~#2 \iow_newline:.~#1
}
}
\cs_set_nopar:Nn\_typoAid_Alphabet_string:{Alphabet~length:~\dim_use:N\l__typoAid_Alphabet_dim}
\cs_set_nopar:Nn\_typoAid_ExHeight_string:{%
Ex~height:~\dim_use:N\l__typoAid_ExHeight_dim
}
\cs_set_nopar:Npn\_typoAid_EmWidth_string:{%
Em~width:~\dim_use:N\l__typoAid_EmWidth_dim
}
\ProvideDocumentCommand{\typrintalph}{ s m }%
{%
\_typoAid_incrCntr:n{#2}
\IfBooleanTF{#1}{%
\msg_term:n{\l__typoAid_typeout_string#2\iow_newline:*~\_typoAid_Alphabet_string:}%
}{%
\_typoAid_Alphabet_string:%
}%
\_typoAid_log:n{\_typoAid_Alphabet_string:}{ #2}
}
\ProvideDocumentCommand{\typrintex}{ s m }{%
\_typoAid_calcEx:n{#2}
\IfBooleanTF{#1}{%
\msg_term:n{\l__typoAid_typeout_string#2 \iow_newline:*~ \_typoAid_ExHeight_string:}%
}{%
\_typoAid_ExHeight_string:%
}%
\_typoAid_log:n{\_typoAid_ExHeight_string:}{ #2}
}
\ProvideDocumentCommand{\typrintem}{s m}{%
\_typoAid_calcEm:n{#2}
\IfBooleanTF{#1}{%
\msg_term:n{\l__typoAid_typeout_string #2 \iow_newline:*~ \_typoAid_EmWidth_string:}%
}{%
\_typoAid_EmWidth_string:
}%
\_typoAid_log:n{\_typoAid_EmWidth_string:}{ #2}
}
\ProvideDocumentCommand{\typrintall}{ s m}{%
\IfBooleanTF{#1}{%
\typrintalph*{#2}\\
\typrintex*{#2}\\
\typrintem*{#2}\\
}{%
\typrintalph{#2}\\
\typrintex{#2}\\
\typrintem{#2}\\
}
}
%%\ExplSyntaxOff
|