Skip to content

Commit

Permalink
plan with scripts needed tweaking for test suite to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr committed Apr 20, 2024
1 parent a866a66 commit 324a226
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 7 deletions.
50 changes: 47 additions & 3 deletions fontspec-code-feat-opentype.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,16 @@
\clist_map_break:
}
}

% \end{macrocode}
% If not found give a warning but load it anyway:
% \begin{macrocode}
\bool_if:NF \l_@@_scriptlang_exist_bool
{
%<debug>\typeout{Script~not~found!}
\@@_warning:nxx {no-script} {\l_fontspec_fontname_tl} {#1}
\clist_set:Nn \l_tmpa_clist {#2}
\clist_get:NN \l_tmpa_clist \l_@@_script_tl
\exp_args:Noo \@@_check_script:NnT \l_@@_fontface_cs_tl \l_@@_script_tl
\exp_args:Noo \@@_check_script:NnF \l_@@_fontface_cs_tl \l_@@_script_tl
{
\tl_set:Nn \l_@@_script_name_tl {#1}
\int_set:Nn \l_@@_script_int {\l_@@_strnum_int}
Expand All @@ -487,6 +489,37 @@
}
}
}
\cs_new:Nn \fontspec_default_script:nn
{
\keys_define:nn {fontspec-opentype} { Script / #1 .code:n =
{
%<debug>\typeout{Trying~[Script=#1:#2]}
\bool_set_false:N \l_@@_scriptlang_exist_bool
\clist_map_inline:nn {#2}
{
\exp_args:No \@@_check_script:NnT \l_@@_fontface_cs_tl {####1}
{
%<debug>\typeout{Script~tag~found:~####1}
\tl_set:Nn \l_@@_script_name_tl {#1}
\tl_set:Nn \l_@@_script_tl {####1}
\int_set:Nn \l_@@_script_int {\l_@@_strnum_int}
\bool_set_true:N \l_@@_scriptlang_exist_bool
\tl_gset:Nx \g_@@_single_feat_tl { script=####1 }
\clist_map_break:
}
}
\bool_if:NF \l_@@_scriptlang_exist_bool
{
%<debug>\typeout{Script~not~found!}
\tl_clear:Nn \l_@@_script_name_tl
}
}
}
}
% \end{macrocode}
% When script is not explicitly requested, use this list:
% \begin{macrocode}
\fontspec_default_script:nn {CustomDefault} {latn,DFLT}
% \end{macrocode}
%
%
Expand Down Expand Up @@ -514,10 +547,21 @@
\clist_map_break:
}
}
% \end{macrocode}
% If not found give a warning but load it anyway:
% \begin{macrocode}
\bool_if:NF \l_@@_scriptlang_exist_bool
{
%<debug>\typeout{Lang~not~found!}
\@@_warning:nx {language-not-exist} {#1}
\keys_set:nn {fontspec-opentype} { Language = Default }
\clist_set:Nn \l_tmpa_clist {#2}
\clist_get:NN \l_tmpa_clist \l_@@_lang_tl
\exp_args:Noo \@@_check_script:NnF \l_@@_fontface_cs_tl \l_@@_script_tl
{
\tl_set:Nn \l_@@_script_name_tl {#1}
\int_set:Nn \l_@@_language_int {\l_@@_strnum_int}
\tl_gset:Nx \g_@@_single_feat_tl { language=####1 }
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion fontspec-code-opentype.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
% font. \cmd\l_@@_script_int\ is used to store
% the number corresponding to the script tag string.
% \begin{macrocode}
\prg_new_conditional:Nnn \@@_check_script:Nn {TF,T}
\prg_new_conditional:Nnn \@@_check_script:Nn {TF,T,F}
{
%<debug>\typeout{:: _check_script:Nn~#1~/~#2}
\bool_if:NTF \l_@@_never_check_bool
Expand Down
2 changes: 1 addition & 1 deletion fontspec-code-vars.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
% \begin{macrocode}
\tl_new:N \l_@@_script_tl
\tl_new:N \l_@@_script_name_tl
\tl_set:Nn \l_@@_script_name_tl {Default}
\tl_set:Nn \l_@@_script_name_tl {CustomDefault}
% \end{macrocode}
%
% \begin{macrocode}
Expand Down
2 changes: 1 addition & 1 deletion testfiles/script-lang.luatex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ TU/texgyrepagella-regular.otf(2)/m/n:
[texgyrepagella-regular.otf]:mode=node;script=latn;language=ROM;+tlig;
LANG DFLT
TU/texgyrepagella-regular.otf(3)/m/n:
[texgyrepagella-regular.otf]:mode=node;script=cyrl;language=dflt;+tlig;
[texgyrepagella-regular.otf]:mode=node;script=cyrl;language=ROM;+tlig;
***************
Compilation 1 of test file completed with exit status 0
2 changes: 1 addition & 1 deletion testfiles/script-lang.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ TU/texgyrepagella-regular.otf(2)/m/n:
"[texgyrepagella-regular.otf]/OT:script=latn;language=ROM;mapping=tex-text;" at 10.0pt
LANG DFLT
TU/texgyrepagella-regular.otf(3)/m/n:
"[texgyrepagella-regular.otf]/OT:script=cyrl;language=dflt;mapping=tex-text;" at 10.0pt
"[texgyrepagella-regular.otf]/OT:script=cyrl;language=ROM;mapping=tex-text;" at 10.0pt
***************
Compilation 1 of test file completed with exit status 0

0 comments on commit 324a226

Please sign in to comment.