Closed muzimuzhi closed 4 years ago
Definition of \EncodingCommand misses one optional argument, hence does not match the doc and underlying \DeclareTextCommand.
\EncodingCommand
\DeclareTextCommand
\EncodingCommand is documented as having two optional arguments, see https://github.com/wspr/fontspec/blob/c1fdf6d52c75017656c4d99ca5b4711353da125d/fontspec-doc-enc.tex#L189 But this command is defined as accepting only one optional argument, see https://github.com/wspr/fontspec/blob/c1fdf6d52c75017656c4d99ca5b4711353da125d/fontspec-code-enc.dtx#L28-L33
Since the underlying \DeclareTextCommand accepts two optional arguments, \EncodingCommand should accept two optional, too. https://github.com/wspr/fontspec/blob/c1fdf6d52c75017656c4d99ca5b4711353da125d/fontspec-doc-enc.tex#L178
Changing the definition of \EncodingCommand to the following will do the work.
\DeclareDocumentCommand \EncodingCommand { m O{} O{} m } { \bool_if:NF \l_@@_defining_encoding_bool { \@@_error:nn {only-inside-encdef} \EncodingCommand } \DeclareTextCommand{#1}{\UnicodeEncodingName}[#2][#3]{#4} }
fixed in https://github.com/wspr/fontspec/commit/72a8b67d685756c4830c13a208fe129a242814de
Description
Definition of
\EncodingCommand
misses one optional argument, hence does not match the doc and underlying\DeclareTextCommand
.Check/indicate
Further details
\EncodingCommand
is documented as having two optional arguments, see https://github.com/wspr/fontspec/blob/c1fdf6d52c75017656c4d99ca5b4711353da125d/fontspec-doc-enc.tex#L189 But this command is defined as accepting only one optional argument, see https://github.com/wspr/fontspec/blob/c1fdf6d52c75017656c4d99ca5b4711353da125d/fontspec-code-enc.dtx#L28-L33Since the underlying
\DeclareTextCommand
accepts two optional arguments,\EncodingCommand
should accept two optional, too. https://github.com/wspr/fontspec/blob/c1fdf6d52c75017656c4d99ca5b4711353da125d/fontspec-doc-enc.tex#L178Possible solution
Changing the definition of
\EncodingCommand
to the following will do the work.