Related: keyreader: How to save choice key value to a macro.
I’m using l3keys2e
, but I suspect this might not be the ideal way to go about what I’m trying to do.
I’m building a private package with various tweaks to font setups:
\bool_if:nTF { \xetex_if_engine_p: || \luatex_if_engine_p: }
{ \clist_const:Nn \c_jcsfonts_clist { lmodern, fontin, constantia } }
{ \clist_const:Nn \c_jcsfonts_clist { cmodern, kpfonts } }
I’m trying to set things up so \usepackage[font = choice]{jcsfonts}
will enable the correct batch of customizations, with the first entry in the list being the default. This doesn’t seem to work:
\cs_generate_variant:Nn \quark_new:N {c}
\clist_map_inline:Nn \c_jcsfonts_clist { \quark_new:c { q_jcsfonts_ #1 } }
\keys_define:nn { jcsfonts }
{
font .choice_code:n =
{ \cs_set_eq:Nc \q_jcsfonts { q_jcsfonts \tl_use:N \l_keys_choice_tl } } ,
font .generate_choices:n = { \clist_use:Nnnn \c_jcsfonts_clist {,} {,} {,} } ,
}
\prg_new_conditional:Npnn \jcsfonts_if:n #1 { p, T, F, TF }
{
\cs_if_eq:NcTF \q_jcsfonts { q_jcsfonts_ #1 }
{ \prg_return_true: } { \prg_return_false: }
}
\ProcessKeysOptions { jcsfonts }
What is the preferred way to accomplish this?