summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
blob: 5298ad11cc0b7d1279994678aab518560aa7aebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
%%
%% This is file `fontspec-patches.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fontspec.dtx  (with options: `patches')
%% 
%%   _________________________________________
%%   The fontspec package for XeLaTeX/LuaLaTeX
%%   (C) 2004--2010    Will Robertson and Khaled Hosny
%% 
%%   License information appended.
%% 
%% 
\ProvidesPackage{fontspec-patches}
  [2010/06/03 v2.0b2 Advanced font selection for XeLaTeX/LuaLaTeX]
\ExplSyntaxOn
\RequirePackage{fixltx2e}[2006/03/24]
\DeclareRobustCommand \em {
  \@nomath\em
  \tl_if_eq:xxTF \f@shape \itdefault \eminnershape \emshape
}
\DeclareTextFontCommand{\emph}{\em}
\let\emshape\itshape
\let\eminnershape\upshape
\DeclareRobustCommand{\-}{%
  \discretionary{%
    \char\ifnum\hyphenchar\font<\z@
           \xlx@defaulthyphenchar
         \else
           \hyphenchar\font
         \fi}{}{}}
\def\xlx@defaulthyphenchar{`\-}
\def\xxt@visiblespace{
  \iffontchar\font"2423
    \expandafter\textvisiblespace
  \else
    \expandafter\xxt@visiblespace@fallback
  \fi
}
\def\xxt@visiblespace@fallback{
  {
    \usefont{EU1}{lmtt}{\f@series}{\f@shape}
    \textvisiblespace
  }
}
\begingroup
  \catcode`\~=\active
  \gdef\xxt@vprintspaces{\catcode`\~\active\let \xxt@visiblespace}
\endgroup
\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{\xxt@vprintspaces\@sverb}
\AtBeginDocument{
  \fontspec_patch_verbatim:
  \fontspec_patch_moreverb:
  \fontspec_patch_fancyvrb:
  \fontspec_patch_listings:
}
\cs_set:Npn \fontspec_patch_verbatim: {
  \@ifpackageloaded{verbatim}{
    \@namedef{verbatim*}{
      \begingroup\@verbatim\xxt@vprintspaces\verbatim@start
    }
  }{
    \@namedef{verbatim*}{\@verbatim\xxt@vprintspaces\@sxverbatim}
  }
}
\cs_set:Npn \fontspec_patch_moreverb: {
  \@ifpackageloaded{moreverb}{
    \@namedef{listingcont*}{
      \def\verbatim@processline{
        \thelisting@line \global\advance\listing@line\c_one
        \the\verbatim@line\par
      }
      \@verbatim\xxt@vprintspaces\verbatim@start
    }
  }{}}
\cs_set:Npn \fontspec_patch_fancyvrb: {
  \@ifpackageloaded{fancyvrb}{
    \let\FancyVerbSpace\xxt@visiblespace
  }{}
}
\cs_set:Npn \fontspec_patch_listings: {
  \@ifpackageloaded{listings}{
    \let\lst@visiblespace\xxt@visiblespace
  }{}
}
%% 
%% Copyright 2004--2010 Will Robertson <wspr81@gmail.com>
%% Copyright 2009--2010 Khaled Hosny <khaledhosny@eglug.org>
%% 
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "author-maintained" by Will Robertson.
%% 
%% This work consists of this file fontspec.dtx
%%           and the derived files fontspec.sty,
%%                                 fontspec.lua,
%%                                 fontspec.cfg,
%%                                 fontspec-xetex.tex,
%%                                 fontspec-luatex.tex,
%%                             and fontspec.pdf.
%% 
%%
%% End of file `fontspec-patches.sty'.