summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/dejavu-otf/dejavu-otf.sty
blob: 95c293473ccf58adbc5c5dccad7cda50989191f2 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
%% $Id: dejavu-otf.sty 556 2017-09-18 06:22:29Z herbert $
%%
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory  macros/latex/base/lppl.txt.
%% Either version 1.3 or, at your option, any later version.
%%
% Copyright 2017 Herbert Voss hvoss@tug.org
%%
\ProvidesPackage{dejavu-otf}[%
  2017/12/05 v. 0.04 (Herbert Voss) Supports DejaVu OpenType for lualatex/xelatex.] 
%
\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}
\RequirePackage{unicode-math}  % support opentype math fonts
                               % loads itself fontspec
%
\newif\ifDejaVu@usefilenames \DejaVu@usefilenamesfalse
\DeclareOptionX{usefilenames}[true]{\@nameuse{DejaVu@usefilenames#1}}

\newif\ifDejaVu@mono  \DejaVu@monotrue
\newif\ifDejaVu@serif \DejaVu@seriftrue
\newif\ifDejaVu@sans  \DejaVu@sanstrue
\newif\ifDejaVu@math  \DejaVu@mathtrue

\DeclareOptionX{mono}[true]{\@nameuse{DejaVu@mono#1}}
\DeclareOptionX{sans}[true]{\@nameuse{DejaVu@sans#1}}
\DeclareOptionX{serif}[true]{\@nameuse{DejaVu@serif#1}}
\DeclareOptionX{math}[true]{\@nameuse{DejaVu@math#1}}
%
\providecommand\DejaVuRM@features{Scale=0.92}%  Roman
\providecommand\DejaVuSS@features{Scale=0.92}%  SansSerif
\providecommand\DejaVuTT@features{Scale=MatchLowercase,FakeStretch=0.9}%  Typewriter
\providecommand\DejaVuMM@features{}%            Math regular
\providecommand\DejaVuMMbold@features{}%        Math bold
\providecommand\DejaVu@DefaultFeatures{}
\DeclareOptionX{RM}{\renewcommand*{\DejaVuRM@features}{#1}}
\DeclareOptionX{SS}{\renewcommand*{\DejaVuSS@features}{#1}}
\DeclareOptionX{TT}{\renewcommand*{\DejaVuTT@features}{#1}}
\DeclareOptionX{MM}{\renewcommand*{\DejaVuMM@features}{#1}}
\DeclareOptionX{MMbold}{\renewcommand*{\DejaVuMMbold@features}{#1}}
\DeclareOptionX{DefaultFeatures}{\def\DejaVu@DefaultFeatures{#1}}

\ProcessOptionsX\relax

\defaultfontfeatures{Ligatures=TeX,RawFeature={-smcp},\DejaVu@DefaultFeatures}% default in fontspec
%
\ifDejaVu@usefilenames
%
  \ifDejaVu@serif
    \setmainfont{DejaVuSerif}[% main rm
      \DejaVuRM@features,
           Extension = .ttf,
          UprightFont= *,
            BoldFont = *-Bold,
          ItalicFont = *-Italic,
      BoldItalicFont = *-BoldItalic,
    ]
  \fi
%
  \ifDejaVu@sans
    \setsansfont{DejaVuSans}[% main sans
           Extension = .ttf,
      \DejaVuSS@features,
          UprightFont= *,
            BoldFont = *-Bold,
           ItalicFont= *-Oblique,
      BoldItalicFont = *-BoldOblique,
    ]
  \fi
%
  \ifDejaVu@mono
    \setmonofont{DejaVuSansMono}[% main typewriter
        UprightFont = *,
           Extension = .ttf,
            BoldFont = *-Bold,
           ItalicFont= *-Oblique,
      BoldItalicFont = *-BoldOblique,
      \DejaVuTT@features,
    ]
  \fi
%
  % Setting math
  % First we have to expand the feature macros:
  \ifDejaVu@math
    \edef\Set@MathNormal{\noexpand\setmathfont{texgyredejavu-math.otf}[AutoFakeBold=1.4,\DejaVuMM@features,version=normal]}%
    \Set@MathNormal
%    \ifxetex
%      \edef\Set@MathBold{\noexpand\setmathfont{texgyredejavu-math.otf}[AutoFakeBold=2,\DejaVuMMbold@features,version=bold]}%
%      \Set@MathBold
%    \fi
  \fi
%
  \newfontfamily\DejaVuSerifCondensed{DejaVuSerifCondensed}[% 
      \DejaVuRM@features,
           Extension = .ttf,
          UprightFont= *,
            BoldFont = *-Bold,
          ItalicFont = *-Italic,
      BoldItalicFont = *-BoldItalic,
    ]
  \newfontfamily\DejaVuSansCondensed{DejaVuSansCondensed}[% 
           Extension = .ttf,
      \DejaVuSS@features,
          UprightFont= *,
            BoldFont = *-Bold,
           ItalicFont= *-Oblique,
      BoldItalicFont = *-BoldOblique,
    ]
  \newfontfamily\DejaVuSansLight{DejaVuSans-ExtraLight}[% 
           Extension = .ttf,
      \DejaVuSS@features,
            BoldFont = *-Bold,
           ItalicFont= *-Oblique,
      BoldItalicFont = *-BoldOblique,
    ]

\else
%-----------------------------------------  symbolic names ----------------------------
\typeout {Using symbolic names for the DejaVu font}%
\ifDejaVu@serif
  \setmainfont{DejaVu Serif}[% main rm
    \DejaVuRM@features,
        UprightFont= *,
          BoldFont = * Bold,
        ItalicFont = * Italic,
    BoldItalicFont = * Bold Italic,
    SmallCapsFont  = *, %
%    SmallCapsFeatures={Letters=SmallCaps},
%    UprightFeatures = { SmallCapsFont={ <sc> }},
%    BoldFeatures = { SmallCapsFont={ <bf sc> }},
%    ItalicFeatures = { SmallCapsFont={ <it sc> }},
%    BoldItalicFeatures = { SmallCapsFont={ <bf it sc> }},
  ]
\fi
%
\ifDejaVu@sans
  \setsansfont{DejaVu Sans}[% main sans
    \DejaVuSS@features,
        UprightFont= *,
          BoldFont = * Bold,
         ItalicFont= * Oblique,
    BoldItalicFont = * Bold Oblique,
%    SmallCapsFont  = *, %
%    SmallCapsFeatures={Letters=SmallCaps},
  ]
\fi
%
\ifDejaVu@mono
  \setmonofont{DejaVu Sans Mono}[
        UprightFont= *,
    \DejaVuTT@features,
          BoldFont = * Bold,
         ItalicFont= * Oblique,
    BoldItalicFont = * Bold Oblique,
  ]
\fi
%
% Setting math
% First we have to expand the feature macros:
\ifDejaVu@math
  \ifxetex
    \edef\Set@MathNormal{\noexpand\setmathfont{texgyredejavu-math.otf}[AutoFakeBold=1,\DejaVuMMbold@features]}%
  \else
    \edef\Set@MathNormal{\noexpand\setmathfont{TeXGyreDejaVuMath-Regular}[\DejaVuMM@features]%
                         \noexpand\setmathfont{TeXGyreDejaVuMath-Regular}[\DejaVuMM@features,version=bold]%
    }%
  \fi
  \Set@MathNormal
\fi

  \newfontfamily\DejaVuSerifCondensed{DejaVu Serif Condensed}[% 
      \DejaVuRM@features,
          UprightFont= *,
            BoldFont = * Bold,
          ItalicFont = * Italic,
      BoldItalicFont = * Bold Italic,
    ]
  \newfontfamily\DejaVuSansCondensed{DejaVu Sans Condensed}[% 
      \DejaVuSS@features,
          UprightFont= *,
            BoldFont = * Bold,
           ItalicFont= * Oblique,
      BoldItalicFont = * Bold Oblique,
    ]
  \newfontfamily\DejaVuSansLight{DejaVu Sans ExtraLight}[% 
      \DejaVuSS@features,
    ]


\fi

\endinput