diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-25 21:39:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-25 21:39:16 +0000 |
commit | 23edf44c0fa366f56bbf60968fb3d292de1c013b (patch) | |
tree | 3c6ed55b24548cb0d7f114436561b8dfdde3dcb7 /Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx | |
parent | 0e0ce19bee540ba50ee3da3872ac10007cfde60f (diff) |
fontspec (25jan19)
git-svn-id: svn://tug.org/texlive/trunk@49816 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx index a191e39f423..14037be0757 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-code-patches.dtx @@ -6,26 +6,6 @@ %<*fontspec> % \end{macrocode} % -% \subsection{\cmd\-} -% -% \begin{macro}{\-} -% This macro is courtesy of Frank Mittelbach and the \LaTeXe\ source code. -% \begin{macrocode} -\DeclareRobustCommand{\-} - { - \discretionary - { - \char\ifnum\hyphenchar\font<\z@ - \xlx@defaulthyphenchar - \else - \hyphenchar\font - \fi - }{}{} - } -\def\xlx@defaulthyphenchar{`\-} -% \end{macrocode} -% \end{macro} -% % % \subsection{Verbatims} % @@ -34,7 +14,7 @@ % \begin{macro}{\fontspec_visible_space:} % Print \unichar{2423}{Open box}, which is used to visibly display a space character. % \begin{macrocode} -\cs_new:Nn \fontspec_visible_space: +\cs_new_protected:Nn \fontspec_visible_space: { \@@_primitive_font_glyph_if_exist:NnTF \font {"2423} { \char"2423\scan_stop: } @@ -46,7 +26,7 @@ % \begin{macro}{\fontspec_visible_space_fallback:} % If the current font doesn't have \unichar{2423}{Open box}, use Latin Modern Mono instead. % \begin{macrocode} -\cs_new:Nn \fontspec_visible_space_fallback: +\cs_new_protected:Nn \fontspec_visible_space_fallback: { { \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape} @@ -69,38 +49,50 @@ % \end{macrocode} % \end{macro} % +% In 2019 there will be a new kernel-supported command for generalising `verbatim visible spaces'. +% For now we check if the new command is defined and disable all patching if so. +% In 2020, I suppose, I'll remove all the patching code here. +% +% \begin{macrocode} +\AtBeginDocument + { + \cs_if_exist:NF \verbvisiblespace + { + \@@_patch_verb: + \@@_patch_verbatim: + \@@_patch_moreverb: + \@@_patch_fancyvrb: + \@@_patch_listings: + } + } +% \end{macrocode} +% +% % \begin{macro}{\verb} % \begin{macro}{\verb*} % Redefine \cmd\verb\ to use \cmd\fontspec_print_visible_spaces:. % \begin{macrocode} -\def\verb +\cs_new_protected:Npn \@@_patch_verb: { - \relax\ifmmode\hbox\else\leavevmode\null\fi - \bgroup - \verb@eol@error \let\do\@makeother \dospecials - \verbatim@font\@noligs - \@ifstar\@@sverb\@verb - } -\def\@@sverb{\fontspec_print_visible_spaces:\@sverb} + \def\verb + { + \relax\ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \verb@eol@error \let\do\@makeother \dospecials + \verbatim@font\@noligs + \@ifstar\@@sverb\@verb + } + \def\@@sverb{\fontspec_print_visible_spaces:\@sverb} + } % \end{macrocode} % \end{macro} % \end{macro} % -% It's better to put small things into \cmd\AtBeginDocument, so here we go: -% \begin{macrocode} -\AtBeginDocument - { - \fontspec_patch_verbatim: - \fontspec_patch_moreverb: - \fontspec_patch_fancyvrb: - \fontspec_patch_listings: - } -% \end{macrocode} % % \begin{environment}{verbatim*} % With the \pkg{verbatim} package. % \begin{macrocode} -\cs_set:Npn \fontspec_patch_verbatim: +\cs_new_protected:Npn \@@_patch_verbatim: { \@ifpackageloaded{verbatim} { @@ -126,7 +118,7 @@ % This is for \pkg{moreverb}. % The main |listing*| environment inherits this definition. % \begin{macrocode} -\cs_set:Npn \fontspec_patch_moreverb: +\cs_new_protected:Npn \@@_patch_moreverb: { \@ifpackageloaded{moreverb} { @@ -146,7 +138,7 @@ % % \pkg{listings} and \pkg{fancvrb} make things nice and easy: % \begin{macrocode} -\cs_set:Npn \fontspec_patch_fancyvrb: +\cs_new_protected:Npn \@@_patch_fancyvrb: { \@ifpackageloaded{fancyvrb} { @@ -156,7 +148,7 @@ % \end{macrocode} % % \begin{macrocode} -\cs_set:Npn \fontspec_patch_listings: +\cs_new_protected:Npn \@@_patch_listings: { \@ifpackageloaded{listings} { |