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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
%%
%% This is file `GfsDidotSourire.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% GfsDidotSourire.dtx (with options: `package')
%% ----------------------------------------------------------------
%% GfsDidotSourire --- Command to use the Gfs Didot fonts in the documents
%% of Sourire Informatique.
%% E-mail: tech.support@sourire.ch
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
\RequirePackage{xparse,expl3,l3keys2e}
\ProvidesExplPackage {GfsDidotSourire} {2020-08-11} {1.0}
{Provide commands to setup and manipulate the Gfs
Didot font within the documents produced by Sourire
Informatique.}
\AtBeginDocument{\ExplSyntaxOff}
\tl_const:Nn \c__GfsDidotSO_GfsDidotRm_tl {GFSDidot}
\tl_const:Nn \c__GfsDidotSO_GfsDidotSf_tl {GFSNeohellenic}
\tl_const:Nn \c__GfsDidotSO_LucidaSfIt_tl {LucidaSansOT-Italic}
\tl_const:Nn \c__GfsDidotSO_LucidaSfItBx_tl {LucidaSansOT-DemiItalic}
\tl_const:Nn \c__GfsDidotSO_LucidaExtension_tl {.otf}
\tl_const:Nn \c__GfsDidotSO_lmSfIt_tl {lmsans10-oblique}
\tl_const:Nn \c__GfsDidotSO_lmSfItBx_tl {lmsans10-boldoblique}
\tl_const:Nn \c__GfsDidotSO_lmExtension_tl {.otf}
\tl_const:Nn \c__GfsDidotSO_MathRm_tl {Asana-Math}
\tl_const:Nn \c__GfsDidotSO_MathSf_tl {GFSNeohellenicMath}
\tl_const:Nn \c__GfsDidotSO_MathExtension_tl {.otf}
\tl_const:Nn \c__GfsDidotSO_GfsDidotTt_tl {DejaVuSansMono}
\str_const:Nn \c__GfsDidotSO_HtmlMode_str {HTML}
\str_const:Nn \c__GfsDidotSO_PapierMode_str {PAPIER}
\str_const:Nn \c__GfsDidotSO_NoneMode_str {AUCUN}
\cs_set:Npx \GfsDidotModeHtml { \str_use:N \c__GfsDidotSO_HtmlMode_str }
\cs_set:Npx \GfsDidotModePapier { \str_use:N \c__GfsDidotSO_PapierMode_str }
\cs_set:Npx \GfsDidotModeNone { \str_use:N \c__GfsDidotSO_NoneMode_str }
\bool_new:N \g__GfsDidotSO_NeoHellenicOnly_bool
\bool_set_false:N \g__GfsDidotSO_NeoHellenicOnly_bool
\bool_new:N \g__GfsDidotSO_greekfont_bool
\bool_set_true:N \g__GfsDidotSO_greekfont_bool
\bool_new:N \g__GfsDidotSO_DefAuto_bool
\bool_set_true:N \g__GfsDidotSO_DefAuto_bool
\bool_new:N \g__GfsDidotSO_MathFonts_bool
\bool_set_true:N \g__GfsDidotSO_MathFonts_bool
\tl_new:N \g__GfsDidotSO_mode_str
\tl_set:Nx \g__GfsDidotSO_mode_str { \c__GfsDidotSO_PapierMode_str }
\tl_set:Nx \l__GfsDidotSO_mode_str { \c__GfsDidotSO_PapierMode_str }
\tl_new:N \g__GfsDidotSO_SfItReplSpec_tl
\tl_new:N \g__GfsDidotSO_MathFontName_tl
\tl_set:Nx \g__GfsDidotSO_MathFontName_tl { \tl_use:N \c__GfsDidotSO_MathRm_tl }
\tl_new:N \g__GfsDidotSO_gfsdidotRmSpec_tl
\tl_new:N \g__GfsDidotSO_gfsdidotSfSpec_tl
\tl_new:N \g__GfsDidotSO_gfsdidotTtSpec_tl
\tl_new:N \g__GfsDidotSO_GreekRmSpec_tl
\tl_new:N \g__GfsDidotSO_GreekSfSpec_tl
\tl_new:N \g__GfsDidotSO_GreekTtSpec_tl
\tl_new:N \g__GfsDidotSO_SfItReplLuSpec_tl
\tl_new:N \g__GfsDidotSO_SfItReplLmSpec_tl
\tl_new:N \g__GfsDidotSO_MathFontSpec_tl
\tl_set:Nx \g__GfsDidotSO_gfsdidotRmSpec_tl
{
Extension=.otf,
UprightFont=*,
BoldFont=*Bold,
ItalicFont=*Italic,
BoldItalicFont=*BoldItalic,
}
\tl_set:Nx \g__GfsDidotSO_gfsdidotSfSpec_tl
{
Extension=.otf,
UprightFont=*,
BoldFont=*Bold,
BoldItalicFont=*BoldIt,
ItalicFont=*It,
RawFeature=+pnum,% variable width numbers
WordSpace={0.75,0.75,1},
Scale=MatchLowercase,
}
\tl_set:Nx \g__GfsDidotSO_gfsdidotTtSpec_tl
{
Extension=.ttf,
UprightFont=*,
BoldFont=*-Bold,
ItalicFont=*-Oblique,
BoldItalicFont=*-BoldOblique,
Scale=MatchLowercase,
}
\tl_set:Nx \g__GfsDidotSO_GreekRmSpec_tl
{
Script=Greek,
\tl_use:N \g__GfsDidotSO_gfsdidotRmSpec_tl
}
\tl_set:Nx \g__GfsDidotSO_GreekSfSpec_tl
{
Script=Greek,
\tl_use:N \g__GfsDidotSO_gfsdidotSfSpec_tl
}
\tl_set:Nx \g__GfsDidotSO_GreekTtSpec_tl
{
Script=Greek,
\tl_use:N \g__GfsDidotSO_gfsdidotTtSpec_tl
}
\tl_set:Nx \g__GfsDidotSO_SfItReplLuSpec_tl
{
ItalicFont=\tl_use:N \c__GfsDidotSO_LucidaSfIt_tl
\tl_use:N \c__GfsDidotSO_LucidaExtension_tl,
BoldItalicFont=\tl_use:N \c__GfsDidotSO_LucidaSfItBx_tl
\tl_use:N \c__GfsDidotSO_LucidaExtension_tl,
Scale = MatchLowercase,
}
\tl_set:Nx \g__GfsDidotSO_SfItReplLmSpec_tl
{
ItalicFont=\tl_use:N \c__GfsDidotSO_lmSfIt_tl
\tl_use:N \c__GfsDidotSO_lmExtension_tl,
BoldItalicFont=\tl_use:N \c__GfsDidotSO_lmSfItBx_tl
\tl_use:N \c__GfsDidotSO_lmExtension_tl,
Scale = MatchLowercase,
}
\tl_set:Nx \g__GfsDidotSO_MathFontSpec_tl
{
Extension=.otf,
Scale = MatchLowercase,
}
\tl_set:Nx \g__GfsDidotSO_SfItReplSpec_tl { \tl_use:N \g__GfsDidotSO_SfItReplLuSpec_tl }
\cs_new:Npn \__GfsDidotSO_ifModeSpecifiable:nTF #1#2#3 {
\group_begin:
\cs_set:Npx \ModeProductionDoc { #1 }
\cs_set:Npn \ModeSpecifiable { #2 }
\cs_set:Npn \ModeNonSpecifiable { #3 }
\str_if_eq:VVTF \ModeProductionDoc \c__GfsDidotSO_NoneMode_str
{ \ModeNonSpecifiable }
{ \ModeSpecifiable }
}
\cs_new:Npn \__GfsDidotSO_tutex_p: { \sys_if_engine_luatex_p: ||
\sys_if_engine_xetex_p:}
\cs_new:Npn \__GfsDidotSO_fontspec_p: { ! (\cs_if_free_p:N \setfontface &&
\cs_if_free_p:N \setfontfamily ) }
\DeclareDocumentCommand \GfsDidotSetup { m }
{ \keys_set:nn { GfsDidotSourire } { #1 } }
\DeclareDocumentCommand \DefCmdGfsDidot { O{\c__GfsDidotSO_NoneMode_str} }
{
\bool_if:nTF { \__GfsDidotSO_tutex_p: } {%TeX Unicode
\bool_if:nTF {\__GfsDidotSO_fontspec_p:} {
\setfontfamily\GfsDidotRm{\tl_use:N \c__GfsDidotSO_GfsDidotRm_tl}%
[\tl_use:N \g__GfsDidotSO_gfsdidotRmSpec_tl,Scale=MatchLowercase,]
\bool_if:nF { \g__GfsDidotSO_NeoHellenicOnly_bool }{%
\tl_gput_right:Nx \g__GfsDidotSO_gfsdidotSfSpec_tl
{ \g__GfsDidotSO_SfItReplSpec_tl }%
}
\setfontfamily\GfsDidotSf{\tl_use:N \c__GfsDidotSO_GfsDidotSf_tl}%
[\tl_use:N \g__GfsDidotSO_gfsdidotSfSpec_tl,%
Scale=MatchLowercase,]%
\setfontfamily\GfsDidotTt{\tl_use:N\c__GfsDidotSO_GfsDidotTt_tl}%
[\tl_use:N \g__GfsDidotSO_gfsdidotTtSpec_tl,%
Scale=MatchLowercase,]%
\bool_if:nT { \g__GfsDidotSO_greekfont_bool }{%
\setfontfamily\greekfont{\tl_use:N \c__GfsDidotSO_GfsDidotRm_tl}%
[ \tl_use:N \g__GfsDidotSO_GreekRmSpec_tl ]
\setfontfamily\greekfontsf{\tl_use:N \c__GfsDidotSO_GfsDidotSf_tl}%
[ \tl_use:N \g__GfsDidotSO_GreekSfSpec_tl ]
\setfontfamily\greekfonttt{\tl_use:N \c__GfsDidotSO_GfsDidotTt_tl}%
[ \tl_use:N \g__GfsDidotSO_GreekTtSpec_tl ]
}%
}%
{%No "fontspec": normally impossible, "fontspec"
%is always loaded!
\bool_if:nT { \g__GfsDidotSO_greekfont_bool }{%
\DeclareDocumentCommand\greekfont{}{\relax}
\DeclareDocumentCommand\greekfontsf{}{\relax}
\DeclareDocumentCommand\greekfonttt{}{\relax}
}
\DeclareDocumentCommand\GfsDidotRm{}{\rmfamily}
\DeclareDocumentCommand\GfsDidotSf{}{\sffamily}
\DeclareDocumentCommand\GfsDidotTt{}{\ttfamily}
}
}{% TeX standards
\bool_if:nT { \g__GfsDidotSO_greekfont_bool }{%
\DeclareDocumentCommand\greekfont{}{\relax}
\DeclareDocumentCommand\greekfontsf{}{\relax}
\DeclareDocumentCommand\greekfonttt{}{\relax}
}
\DeclareDocumentCommand\GfsDidotRm{}{\rmfamily}
\DeclareDocumentCommand\GfsDidotSf{}{\sffamily}
\DeclareDocumentCommand\GfsDidotTt{}{\ttfamily}
}
}
\DeclareDocumentCommand \PoliceGfsDidot { O{\c__GfsDidotSO_NoneMode_str} }
{
\bool_if:nTF { \__GfsDidotSO_tutex_p: } {%TeX Unicode
\setmainfont{\tl_use:N \c__GfsDidotSO_GfsDidotRm_tl}%
[\tl_use:N \g__GfsDidotSO_gfsdidotRmSpec_tl]
\bool_if:nF { \g__GfsDidotSO_NeoHellenicOnly_bool }{%
\tl_gput_right:Nx \g__GfsDidotSO_gfsdidotSfSpec_tl { \g__GfsDidotSO_SfItReplSpec_tl }
}
\setsansfont{\tl_use:N \c__GfsDidotSO_GfsDidotSf_tl}%
[\tl_use:N \g__GfsDidotSO_gfsdidotSfSpec_tl]
\setmonofont{\tl_use:N\c__GfsDidotSO_GfsDidotTt_tl}%
[\tl_use:N \g__GfsDidotSO_gfsdidotTtSpec_tl]%
\DefCmdGfsDidot
}{%
\DefCmdGfsDidot
}%
}
\DeclareDocumentCommand \PoliceGfsDidotMath { O{\c__GfsDidotSO_NoneMode_str} }
{
\bool_if:nTF { \__GfsDidotSO_tutex_p: } {%TeX Unicode
\bool_if:nTF { \g__GfsDidotSO_MathFonts_bool }
{ \use:x {
\setmathfont { \tl_use:N \g__GfsDidotSO_MathFontName_tl }
[\tl_use:N \g__GfsDidotSO_MathFontSpec_tl]
}
}
{ \relax }%
}{%
\relax
}%
}
\keys_define:nn { GfsDidotSourire }
{
NeoHellenicOnly .bool_set:N = \g__GfsDidotSO_NeoHellenicOnly_bool,
math-fonts .bool_set:N = \g__GfsDidotSO_MathFonts_bool,
polygrec .bool_set:N = \g__GfsDidotSO_greekfont_bool,
math .choice:,
math / assana .code:n = \tl_set:Nx \g__GfsDidotSO_MathFontName_tl
{ \tl_use:N \c__GfsDidotSO_MathRf_tl },
math / neohellenic .code:n = \tl_set:Nx \g__GfsDidotSO_MathFontName_tl
{ \tl_use:N \c__GfsDidotSO_MathSf_tl },
SfItRepl .choice:,
SfItRepl / lucida .code:n = \tl_set:Nx \g__GfsDidotSO_SfItReplSpec_tl
{ \tl_use:N \g__GfsDidotSO_SfItReplLuSpec_tl },
SfItRepl / lm .code:n = \tl_set:Nx \g__GfsDidotSO_SfItReplSpec_tl
{ \tl_use:N \g__GfsDidotSO_SfItReplLmSpec_tl },
def .choice:,
def / auto .code:n = \bool_gset_true:N \g__GfsDidotSO_DefAuto_bool,
def / manuel .code:n = \bool_gset_false:N \g__GfsDidotSO_DefAuto_bool,
mode .choice:,
mode / PAPIER .code:n = \tl_gset:Nx \g__GfsDidotSO_mode_str {#1},
mode / HTML .code:n = \tl_gset:Nx \g__GfsDidotSO_mode_str {#1},
}
\ProcessKeysOptions { GfsDidotSourire }
\bool_if:nTF { \__GfsDidotSO_tutex_p: } {
\RequirePackage{fontspec}
\bool_if:nT { \g__GfsDidotSO_MathFonts_bool }
{ \RequirePackage{unicode-math} }
}
{\RequirePackage{DejaVuSansMono}
\RequirePackage{gfsneohellenic}
\RequirePackage{gfsdidot}}
\bool_log:N \g__GfsDidotSO_NeoHellenicOnly_bool
\bool_log:N \g__GfsDidotSO_DefAuto_bool
\bool_log:N \g__GfsDidotSO_greekfont_bool
\bool_log:N \g__GfsDidotSO_MathFonts_bool
\str_log:N \g__GfsDidotSO_mode_str
\tl_log:N \c__GfsDidotSO_GfsDidotRm_tl
\tl_log:N \g__GfsDidotSO_gfsdidotRmSpec_tl
\tl_log:N \g__GfsDidotSO_GreekRmSpec_tl
\tl_log:N \c__GfsDidotSO_GfsDidotSf_tl
\tl_log:N \g__GfsDidotSO_gfsdidotSfSpec_tl
\tl_log:N \g__GfsDidotSO_GreekSfSpec_tl
\tl_log:N \c__GfsDidotSO_GfsDidotTt_tl
\tl_log:N \g__GfsDidotSO_gfsdidotTtSpec_tl
\tl_log:N \g__GfsDidotSO_GreekTtSpec_tl
\tl_log:N \g__GfsDidotSO_MathFontName_tl
\tl_log:N \g__GfsDidotSO_MathFontSpec_tl
\bool_if:NT \g__GfsDidotSO_DefAuto_bool {%
\AtBeginDocument{%
\PoliceGfsDidot[\tl_use:N \g__GfsDidotSO_mode_str]%
\PoliceGfsDidotMath[\tl_use:N \g__GfsDidotSO_mode_str]%
}
}
%%
%% Copyright (C) 2020 by Alain Aubord <alain.aubord@sourire.ch>
%%
%% This work 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:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% This work is "maintained" (as per LPPL maintenance status) by
%% tex.support@sourire.ch.
%%
%% This work consists of the file GfsDidotSourire.dtx
%% and the derived files GfsDidotSourire.ins,
%% prtGfsDidotSourire.sty,
%% testSimpleGfsDidot.tex,
%% testGfsDidot.tex,
%% GfsDidotSourire.pdf and
%% GfsDidotSourire.sty.
%%
%% End of file `GfsDidotSourire.sty'.
|