summaryrefslogtreecommitdiff
path: root/fonts/noto/latex/noto-sans.sty
blob: eb6bbe93fdea873ee39760d1b5fb612523e44af3 (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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{noto-sans}
    [2019/05/18 (Bob Tennent)  Supports NotoSans fonts for all LaTeX engines.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifnotosans@otf 
\ifxetex
  \notosans@otftrue
\else\ifluatex
  \notosans@otftrue
\else  % [pdf]LaTeX
  \notosans@otffalse
\fi\fi

\newif\ifnotosans@sfdefault \notosans@sfdefaultfalse

\newcommand*{\NotoSans@scale}{1}
\DeclareOptionX{scaled}{\renewcommand*{\NotoSans@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\NotoSans@scale}{#1}}


\DeclareOptionX{sfdefault}{\notosans@sfdefaulttrue}
\DeclareOptionX{type1}{\notosans@otffalse}

\newif\ifnotosans@oldstyle \notosans@oldstylefalse
\newif\ifnotosans@proportional \notosans@proportionalfalse

\DeclareOptionX{lining}{\notosans@oldstylefalse}
\DeclareOptionX{lf}{\notosans@oldstylefalse}
\DeclareOptionX{tabular}{\notosans@proportionalfalse}
\DeclareOptionX{tf}{\notosans@proportionalfalse}
\DeclareOptionX{proportional}{\notosans@proportionaltrue}
\DeclareOptionX{pf}{\notosans@proportionaltrue}
\DeclareOptionX{oldstyle}{\notosans@oldstyletrue}
\DeclareOptionX{osf}{\notosans@oldstyletrue}

\newif\ifnotosans@thin \notosans@thinfalse
\newif\ifnotosans@extralight \notosans@extralightfalse
\newif\ifnotosans@light \notosans@lightfalse
\newif\ifnotosans@medium \notosans@mediumfalse
\newif\ifnotosans@semibold \notosans@semiboldfalse
\newif\ifnotosans@extrabold \notosans@extraboldfalse
\newif\ifnotosans@black \notosans@blackfalse

\newif\ifnotosans@condensed \notosans@condensedfalse
\newif\ifnotosans@semicondensed \notosans@semicondensedfalse
\newif\ifnotosans@extracondensed \notosans@extracondensedfalse

\DeclareOptionX{thin}{\notosans@thintrue}
\DeclareOptionX{extralight}{\notosans@extralighttrue}
\DeclareOptionX{light}{\notosans@lighttrue}
\DeclareOptionX{regular}{\notosans@lightfalse\notosans@thinfalse\notosans@extralightfalse\notosans@mediumfalse}
\DeclareOptionX{medium}{\notosans@mediumtrue}
\DeclareOptionX{semibold}{\notosans@semiboldtrue}
\DeclareOptionX{extrabold}{\notosans@extraboldtrue}
\DeclareOptionX{black}{\notosans@blacktrue}
\DeclareOptionX{bold}{\notosans@blackfalse\notosans@semiboldfalse\notosans@extraboldfalse}
\DeclareOptionX{condensed}{\notosans@condensedtrue}
\DeclareOptionX{semicondensed}{\notosans@semicondensedtrue}
\DeclareOptionX{extracondensed}{\notosans@extracondensedtrue}


\ProcessOptionsX\relax

\ifnotosans@otf
  \def\notosans@boldstyle{Bold}
  \ifnotosans@semibold\def\notosans@boldstyle{SemiBold}\fi
  \ifnotosans@extrabold\def\notosans@boldstyle{ExtraBold}\fi
  \ifnotosans@black\def\notosans@boldstyle{Black}\fi
  \def\notosans@regstyle{Regular}
  \ifnotosans@thin\def\notosans@regstyle{Thin}\fi
  \ifnotosans@extralight\def\notosans@regstyle{ExtraLight}\fi
  \ifnotosans@light\def\notosans@regstyle{Light}\fi
  \ifnotosans@medium\def\notosans@regstyle{Medium}\fi

\else % type1
  \def\seriesdefault{\mdseries@sf}

  \def\bfseries@sf{bold}\def\mdseries@sf{regular}
  \ifnotosans@semibold\def\bfseries@sf{semibold}\fi
  \ifnotosans@extrabold\def\bfseries@sf{extrabold}\fi
  \ifnotosans@black\def\bfseries@sf{black}\fi
  \ifnotosans@thin\def\mdseries@sf{thin}\fi
  \ifnotosans@extralight\def\mdseries@sf{extralight}\fi
  \ifnotosans@light\def\mdseries@sf{light}\fi
  \ifnotosans@medium\def\mdseries@sf{medium}\fi

  \ifnotosans@condensed
    \def\bfseries@sf{boldcondensed}\def\mdseries@sf{condensed}
    \ifnotosans@semibold\def\bfseries@sf{semiboldcondensed}\fi
    \ifnotosans@extrabold\def\bfseries@sf{extraboldcondensed}\fi
    \ifnotosans@black\def\bfseries@sf{blackcondensed}\fi
    \ifnotosans@thin\def\mdseries@sf{thincondensed}\fi
    \ifnotosans@extralight\def\mdseries@sf{extralightcondensed}\fi
    \ifnotosans@light\def\mdseries@sf{lightcondensed}\fi
    \ifnotosans@medium\def\mdseries@sf{mediumcondensed}\fi
  \else\ifnotosans@semicondensed
    \def\bfseries@sf{boldsemicondensed}\def\mdseries@sf{semicondensed}
    \ifnotosans@semibold\def\bfseries@sf{semiboldsemicondensed}\fi
    \ifnotosans@extrabold\def\bfseries@sf{extraboldsemicondensed}\fi
    \ifnotosans@black\def\bfseries@sf{blacksemicondensed}\fi
    \ifnotosans@thin\def\mdseries@sf{thinsemicondensed}\fi
    \ifnotosans@extralight\def\mdseries@sf{extralightsemicondensed}\fi
    \ifnotosans@light\def\mdseries@sf{lightsemicondensed}\fi
    \ifnotosans@medium\def\mdseries@sf{mediumsemicondensed}\fi
  \else\ifnotosans@extracondensed
    \def\bfseries@sf{boldextracondensed}\def\mdseries@sf{extracondensed}
    \ifnotosans@semibold\def\bfseries@sf{semiboldextracondensed}\fi
    \ifnotosans@extrabold\def\bfseries@sf{extraboldextracondensed}\fi
    \ifnotosans@black\def\bfseries@sf{blackextracondensed}\fi
    \ifnotosans@thin\def\mdseries@sf{thinextracondensed}\fi
    \ifnotosans@extralight\def\mdseries@sf{extralightextracondensed}\fi
    \ifnotosans@light\def\mdseries@sf{lightextracondensed}\fi
    \ifnotosans@medium\def\mdseries@sf{mediumextracondensed}\fi
  \fi\fi\fi
  
\fi

\ifnotosans@otf
  
  \def\notosans@figurestyle{Lining}
  \ifnotosans@oldstyle\def\notosans@figurestyle{OldStyle}\fi
  \def\notosans@figurealign{Monospaced}
  \ifnotosans@proportional\def\notosans@figurealign{Proportional}\fi

\fi
% type1

  \def\notosans@tonefigurestyle{LF}
  \ifnotosans@oldstyle\def\notosans@tonefigurestyle{OsF}\fi
  \def\notosans@tonefigurealign{T}
  \ifnotosans@proportional\def\notosans@tonefigurealign{}\fi

\ifnotosans@otf
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,fontaxes,mweights}
  \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
  \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
  \def\sufigures{\@nomath\sufigures
      \fontfigurestyle{superior}\selectfont}
\fi

\ifnotosans@otf
  \def\notosans@regular{Regular}
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        Ligatures = TeX ,
        Extension = .ttf }
    \ifnotosans@condensed
      \setsansfont
        [ Scale     = \NotoSans@scale ,
          Numbers   = {\notosans@figurealign, \notosans@figurestyle} ,
          SmallCapsFeatures={Letters=SmallCaps} ,
          UprightFont    = *\ifx\notosans@regstyle\notosans@regular\else\notosans@regstyle\fi ,
          ItalicFont     = *\ifx\notosans@regstyle\notosans@regular Italic\else\notosans@regstyle Italic\fi ,
          BoldFont       = *\notosans@boldstyle , 
          BoldItalicFont = *\notosans@boldstyle Italic ,
        ]
        {NotoSans-Condensed}
    \else\ifnotosans@semicondensed
      \setsansfont
        [ Scale     = \NotoSans@scale ,
          Numbers   = {\notosans@figurealign, \notosans@figurestyle} ,
          SmallCapsFeatures={Letters=SmallCaps} ,
          UprightFont    = *\ifx\notosans@regstyle\notosans@regular\else\notosans@regstyle\fi ,
          ItalicFont     = *\ifx\notosans@regstyle\notosans@regular Italic\else\notosans@regstyle Italic\fi ,
          BoldFont       = *\notosans@boldstyle , 
          BoldItalicFont = *\notosans@boldstyle Italic ,
        ]
        {NotoSans-SemiCondensed}
    \else\ifnotosans@extracondensed
      \setsansfont
        [ Scale     = \NotoSans@scale ,
          Numbers   = {\notosans@figurealign, \notosans@figurestyle} ,
          SmallCapsFeatures={Letters=SmallCaps} ,
          UprightFont    = *\ifx\notosans@regstyle\notosans@regular\else\notosans@regstyle\fi ,
          ItalicFont     = *\ifx\notosans@regstyle\notosans@regular Italic\else\notosans@regstyle Italic\fi ,
          BoldFont       = *\notosans@boldstyle , 
          BoldItalicFont = *\notosans@boldstyle Italic ,
        ]
        {NotoSans-ExtraCondensed}
    \else
      \setsansfont
          [ Scale     = \NotoSans@scale ,
            Numbers   = {\notosans@figurealign, \notosans@figurestyle} ,
            SmallCapsFeatures={Letters=SmallCaps} ,
            UprightFont    = *-\notosans@regstyle ,
            ItalicFont     = *-\ifx\notosans@regstyle\notosans@regular Italic\else\notosans@regstyle Italic\fi ,
            BoldFont       = *-\notosans@boldstyle , 
            BoldItalicFont = *-\notosans@boldstyle Italic ,
          ]
          {NotoSans}
    \fi\fi\fi
    \let\notosansfamily\sfdefault  
  \ifnotosans@sfdefault\renewcommand*\familydefault{\notosansfamily}\fi
  \newfontfamily\notosans
          [ Scale     = \NotoSans@scale ,
            Numbers   = {\notosans@figurealign, \notosans@figurestyle} ,
            SmallCapsFeatures={Letters=SmallCaps} ,
            UprightFont    = *-\notosans@regstyle ,
            ItalicFont     = *-\ifx\notosans@regstyle\notosans@regular Italic\else\notosans@regstyle Italic\fi ,
            BoldFont       = *-\notosans@boldstyle , 
            BoldItalicFont = *-\notosans@boldstyle Italic ,
          ]
          {NotoSans}
  \newfontfamily\notosanscondensed
        [ Scale     = \NotoSans@scale ,
          Numbers   = {\notosans@figurealign, \notosans@figurestyle} ,
          SmallCapsFeatures={Letters=SmallCaps} ,
          UprightFont    = *\ifx\notosans@regstyle\notosans@regular\else\notosans@regstyle\fi ,
          ItalicFont     = *\ifx\notosans@regstyle\notosans@regular Italic\else\notosans@regstyle Italic\fi ,
          BoldFont       = *\notosans@boldstyle , 
          BoldItalicFont = *\notosans@boldstyle Italic ,
        ]
        {NotoSans-Condensed}
  \newfontfamily\notosanssemicondensed
        [ Scale     = \NotoSans@scale ,
          Numbers   = {\notosans@figurealign, \notosans@figurestyle} ,
          SmallCapsFeatures={Letters=SmallCaps} ,
          UprightFont    = *\ifx\notosans@regstyle\notosans@regular\else\notosans@regstyle\fi ,
          ItalicFont     = *\ifx\notosans@regstyle\notosans@regular Italic\else\notosans@regstyle Italic\fi ,
          BoldFont       = *\notosans@boldstyle , 
          BoldItalicFont = *\notosans@boldstyle Italic ,
        ]
        {NotoSans-SemiCondensed}
  \newfontfamily\notosansextracondensed
        [ Scale     = \NotoSans@scale ,
          Numbers   = {\notosans@figurealign, \notosans@figurestyle} ,
          SmallCapsFeatures={Letters=SmallCaps} ,
          UprightFont    = *\ifx\notosans@regstyle\notosans@regular\else\notosans@regstyle\fi ,
          ItalicFont     = *\ifx\notosans@regstyle\notosans@regular Italic\else\notosans@regstyle Italic\fi ,
          BoldFont       = *\notosans@boldstyle , 
          BoldItalicFont = *\notosans@boldstyle Italic  ,
        ]
        {NotoSans-ExtraCondensed}
  \providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}}

\else % type1
  \def\notosansfamily{NotoSans-\notosans@tonefigurealign\notosans@tonefigurestyle}
  \newcommand*\notosans{\fontfamily{\notosansfamily}\selectfont}
  \newcommand*\notosanscondensed{\fontfamily{\notosansfamily}\fontseries{condensed}\selectfont}
  \newcommand*\notosanssemicondensed{\fontfamily{\notosansfamily}\fontseries{semicondensed}\selectfont}
  \newcommand*\notosansextracondensed{\fontfamily{\notosansfamily}\fontseries{extracondensed}\selectfont}
  \def\sfdefault{\notosansfamily} 
  \ifnotosans@sfdefault\edef\familydefault{\sfdefault}\fi
\fi

\DeclareTextFontCommand{\textsu}{\sufigures}

\newcommand*\notosanslgr{\fontencoding{LGR}\fontfamily{NotoSans-\notosans@tonefigurealign\notosans@tonefigurestyle}\selectfont}


\ifnotosans@otf
  % turn off defaults in case other fonts are selected:
  \defaultfontfeatures{}
\fi

\endinput