From 15fc6a83b0ecaa076e6e0a6daf44ed6959b7cbcc Mon Sep 17 00:00:00 2001 From: Will Robertson Date: Sun, 12 May 2024 19:44:52 +0930 Subject: [PATCH] code doc update (fontload) again #496 --- fontspec-code-fontload.dtx | 67 +++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/fontspec-code-fontload.dtx b/fontspec-code-fontload.dtx index 4b36515..44bb9b9 100644 --- a/fontspec-code-fontload.dtx +++ b/fontspec-code-fontload.dtx @@ -2,6 +2,65 @@ % \section{expl3 interface for primitive font loading} % +% \begin{function}{\@@_primitive_font_set:Nnn,\@@_primitive_font_gset:Nnn} +% \begin{syntax} +% |\@@_primitive_font_set:Nnn| \meta{font cs} \Arg{file/name} \Arg{size (dim.\ expr)} +% \end{syntax} +% Wrapper around \TeX\ \cs{font} primitive. +% \end{function} +% +% \begin{function}{\@@_font_suppress_not_found_error:} +% Wrapper around \XeTeX\/Lua\TeX\ primitive, used to be able to programmatically query font existence. +% \end{function} +% +% \begin{function}[pTF]{\@@_primitive_font_if_null:N} +% \begin{syntax} +% |\@@_primitive_font_if_null:NTF| \meta{font cs} \Arg{true code} \Arg{false code} +% \end{syntax} +% Query whether the \meta{font cs} is the \cs{nullfont}. +% \end{function} +% +% \begin{function}[TF]{\@@_primitive_font_set:Nnn,\@@_primitive_font_gset:Nnn} +% \begin{syntax} +% |\@@_primitive_font_set:NnnTF| \meta{font cs} \Arg{file/name} \Arg{size (dim.\ expr)} \Arg{true code} \Arg{false code} +% \end{syntax} +% Attempts to set the \meta{font cs} and provide branching for success or failure according to whether the font exists. +% \end{function} +% +% \begin{function}[TF]{\@@_primitive_font_if_exist:n} +% \begin{syntax} +% |\@@_primitive_font_if_exist:nTF| \Arg{file/name} \Arg{true code} \Arg{false code} +% \end{syntax} +% Attempts to load the font at the current font size minus 1\,sp with a dummy meta{font cs} +% (\verb|\l_@@_primitive_font|), and branches according to whether the font exists. +% This is intended to be used speculatively before potentially performing additional processing +% steps (e.g., an analysis of available font features) before setting up the `true' font. +% \end{function} +% +% \begin{function}[pTF]{\@@_primitive_font_glyph_if_exist:Nn} +% \begin{syntax} +% |\@@_primitive_font_glyph_if_exist:nTF| \meta{font cs} \Arg{char. number (int.\ expr)} \Arg{true code} \Arg{false code} +% \end{syntax} +% Wrapper around primitive \cs{iffontchar}. +% \end{function} +% +% \begin{function}{\@@_primitive_font_set_hyphenchar:Nn} +% \begin{syntax} +% |\@@_primitive_font_set_hyphenchar:Nn| \meta{font cs} \Arg{char. number (int.\ expr)} +% \end{syntax} +% Setter function around primitive \cs{hyphenchar}. +% \end{function} +% +% \begin{function}{\@@_primitive_font_get_name:N,\@@_primitive_font_current_name:} +% \begin{syntax} +% |\@@_primitive_font_get_name:N| \meta{font cs} +% \end{syntax} +% Wrapper function around \TeX\ primitive \cs{fontname}. The no-argument version is +% equivalent to \verb|\fontname\font|. +% \end{function} +% +% \section{Implementation} +% % \iffalse % \begin{macrocode} %<*fontspec> @@ -45,7 +104,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[pTF]{\@@_primitive_font_set:NnnTF,\@@_primitive_font_gset:NnnTF} +% \begin{macro}[TF]{\@@_primitive_font_set:Nnn,\@@_primitive_font_gset:Nnn} % \begin{macrocode} \prg_new_conditional:Nnn \@@_primitive_font_set:Nnn {TF,T,F} { @@ -78,11 +137,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_primitive_font_glyph_if_exist:NnTF} +% \begin{macro}[pTF]{\@@_primitive_font_glyph_if_exist:Nn} % \begin{macrocode} \prg_new_conditional:Nnn \@@_primitive_font_glyph_if_exist:Nn {p,TF,T,F} { - \tex_iffontchar:D #1 #2 \scan_stop: + \tex_iffontchar:D #1 \int_eval:n {#2} \scan_stop: \prg_return_true: \else: \prg_return_false: @@ -95,7 +154,7 @@ % \begin{macrocode} \cs_new:Nn \@@_primitive_font_set_hyphenchar:Nn { - \tex_hyphenchar:D #1 = #2 \scan_stop: + \tex_hyphenchar:D #1 = \int_eval:n {#2} \scan_stop: } % \end{macrocode} % \end{macro}