summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx')
-rw-r--r--Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx61
1 files changed, 46 insertions, 15 deletions
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx
index 15c5aa66c02..7114a8af2ea 100644
--- a/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx
+++ b/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx
@@ -1,7 +1,7 @@
% \section{Patching code}
%
% \begin{macrocode}
-%<*patches>
+%<*fontspec>
% \end{macrocode}
%
%
@@ -97,29 +97,60 @@
% \begin{macro}{\eminnershape}
% \begin{macro}{\emfontdeclare}
% Redefinition of |{\em ...}| and |\emph{...}| to allow nesting of emphases.
+%
% \begin{macrocode}
-\int_new:N \l_@@_em_int
-\int_new:N \l_@@_emdef_int
\cs_new_protected:Npn \emfontdeclare #1
{
- \int_zero:N \l_@@_emdef_int
- \clist_map_inline:nn {#1}
- {
- \int_incr:N \l_@@_emdef_int
- \cs_set:cpn {@@_em_font_ \int_use:N \l_@@_emdef_int _switch:} {##1}
- }
+ \prop_clear:N \g_@@_em_prop
+ \int_zero:N \l_@@_emdef_int
+ \group_begin:
+ \normalfont
+ \clist_map_inline:nn {\emreset,#1}
+ {
+ ##1
+ \prop_gput:NxV \g_@@_em_prop { \f@series/\f@shape } { \l_@@_emdef_int }
+ \prop_gput:Nxn \g_@@_em_prop { switch-\int_use:N \l_@@_emdef_int } { ##1 }
+ \int_incr:N \l_@@_emdef_int
+ }
+ \group_end:
}
+% \end{macrocode}
+%
+% \begin{macrocode}
\DeclareRobustCommand \em
{
\@nomath\em
+
+ \prop_get:NxNT \g_@@_em_prop { \f@series/\f@shape } \l_@@_em_tmp_tl
+ { \int_set:Nn \l_@@_em_int { \l_@@_em_tmp_tl } }
+
\int_incr:N \l_@@_em_int
- \use:c {@@_em_font_ \int_use:N \l_@@_em_int _switch:}
+
+ \prop_get:NxNTF \g_@@_em_prop { switch-\int_use:N \l_@@_em_int } \l_@@_em_switch_tl
+ { \l_@@_em_switch_tl }
+ {
+ \int_zero:N \l_@@_em_int
+ \emreset
+ }
+
}
+% \end{macrocode}
+% Document commands:
+% \begin{macrocode}
\DeclareTextFontCommand{\emph}{\em}
+\cs_set:Npn \emreset { \upshape }
\cs_set:Npn \emshape { \itshape }
\cs_set:Npn \eminnershape { \upshape }
\emfontdeclare{ \emshape, \eminnershape }
% \end{macrocode}
+% Ensure nesting resets when necessary:
+% \begin{macrocode}
+\cs_set:Npn \reset@font { \normalfont \int_zero:N \l__fontspec_em_int }
+% \end{macrocode}
+% Programmer's interface for setting nesting level:
+% \begin{macrocode}
+\cs_new:Nn \fontspec_set_em_level:n { \int_set:Nn \l_@@_em_int {#1} }
+% \end{macrocode}
% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro}
%
% \subsection{\cmd\-}
@@ -148,19 +179,19 @@
% Many thanks to Apostolos Syropoulos for discovering this problem and writing the redefinion of \LaTeX's |verbatim| environment and \cs{verb*} command.
%
% \begin{macro}{\fontspec_visible_space:}
-% Print \unichar{2434}{Open box}, which is used to visibly display a space character.
+% Print \unichar{2423}{Open box}, which is used to visibly display a space character.
% \begin{macrocode}
\cs_new:Nn \fontspec_visible_space:
{
- \font_glyph_if_exist:NnTF \font {"2423}
+ \@@_primitive_font_glyph_if_exist:NnTF \font {"2423}
{ \char"2423\scan_stop: }
{ \fontspec_visible_space_fallback: }
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\fontspec_visible_space:@fallback}
-% If the current font doesn't have \unichar{2434}{Open box}, use Latin Modern Mono instead.
+% \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:
{
@@ -302,5 +333,5 @@
%
%
% \begin{macrocode}
-%</patches>
+%</fontspec>
% \end{macrocode}