summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/realscripts/realscripts.sty
blob: be557c7089099b17f1418278de8d32f87c1f0177 (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
%%
%% This is file `realscripts.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% realscripts.dtx  (with options: `package')
%%   ____________________________
%%   The REALSCRIPTS package
%%   (C) 2010 Will Robertson
%%   License information appended
%% 
\ProvidesPackage{realscripts}
  [2010/09/20 v0.2 Access OpenType subscripts and superscripts]
\RequirePackage{fontspec}[2010/05/14 v2.0]
\ExplSyntaxOn
\cs_if_exist:NTF \textsubscript
{
  \cs_set_eq:NN \fakesubscript \textsubscript
  \cs_set_eq:NN \fakesuperscript \textsuperscript
}
{
  \DeclareDocumentCommand \fakesubscript {m} {
    \@textsubscript{\selectfont#1}
  }
  \DeclareDocumentCommand \fakesuperscript {m} {
    \@textsuperscript{\selectfont#1}
  }
}
\DeclareDocumentCommand \textsubscript {s} {
    \IfBooleanTF #1 \fakesubscript \realsubscript
}
\DeclareDocumentCommand \textsuperscript {s} {
    \IfBooleanTF #1 \fakesuperscript \realsuperscript
}
\DeclareDocumentCommand \realsubscript {m} {
  \fontspec_if_fontspec_font:TF {
    \fontspec_if_opentype:TF
    { \fontspec_if_feature:nTF {+subs}
        { {\addfontfeature{VerticalPosition=Inferior}#1} }
        { \fontspec_if_feature:nTF {+sinf}
            { {\addfontfeature{VerticalPosition=ScientificInferior}#1} }
            { \fakesubscript{#1} }
        }
    }
    { \fontspec_if_aat_feature:nnTF {10} {2}
        { {\addfontfeature{VerticalPosition=Inferior}#1} }
        { \fakesubscript{#1} }
    }
  }
  { \fakesubscript{#1} }
}
\DeclareDocumentCommand \realsuperscript {m} {
  \fontspec_if_fontspec_font:TF
  {
    \fontspec_if_opentype:TF
    { \fontspec_if_feature:nTF {+sups}
      { {\addfontfeature{VerticalPosition=Superior}#1} }
      { \fakesuperscript{#1} }
    }
    { \fontspec_if_aat_feature:nnTF {10} {1}
      { {\addfontfeature{VerticalPosition=Superior}#1} }
      { \fakesuperscript{#1} }
    }
  }
  { \fakesuperscript{#1} }
}
\cs_set:Npn \@makefnmark {
  \mbox{\footnotemarkfont\textsuperscript{\@thefnmark}}
}
\cs_if_exist:NTF \ftntm@font
{
  \cs_new:Npn \footnotemarkfont {\ftntm@font}
}
{
  \cs_new:Npn \footnotemarkfont {\normalfont}
}
%% 
%% Copyright (C) 2010 by Will Robertson <will.robertson@latex-project.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 "maintained" (as per LPPL maintenance status)
%% by Will Robertson.
%% 
%% This work consists of the file  realscripts.dtx
%%           and the derived files realscripts.sty,
%%                                 realscripts.ins, and
%%                                 realscripts.pdf.
%% 
%%
%% End of file `realscripts.sty'.