summaryrefslogtreecommitdiff
path: root/fonts/noto/latex/noto-mono.sty
blob: 61f36d939dcaf65303034f0bd0429d0b581e06dd (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{noto-mono}
    [2019/10/22 (Bob Tennent)  Supports NotoSansMono fonts for all LaTeX engines.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifnotomono@otf 
\ifxetex
  \notomono@otftrue
\else\ifluatex
  \notomono@otftrue
\else  % [pdf]LaTeX
  \notomono@otffalse
\fi\fi

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


\DeclareOptionX{type1}{\notomono@otffalse}

\newif\ifnotomono@oldstyle \notomono@oldstylefalse
\newif\ifnotomono@proportional \notomono@proportionalfalse

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

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

\newif\ifnotomono@condensed \notomono@condensedfalse
\newif\ifnotomono@semicondensed \notomono@semicondensedfalse
\newif\ifnotomono@extracondensed \notomono@extracondensedfalse

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


\ProcessOptionsX\relax

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

\else % type1
  \def\bfseries@tt{bold}\def\mdseries@tt{m}
  \ifnotomono@semibold\def\bfseries@tt{sb}\fi
  \ifnotomono@extrabold\bfseries@tt{eb}\fi
  \ifnotomono@black\def\bfseries@tt{ub}\fi
  \ifnotomono@thin\def\mdseries@tt{ul}\fi
  \ifnotomono@extralight\def\mdseries@tt{el}\fi
  \ifnotomono@light\def\mdseries@tt{l}\fi
  \ifnotomono@medium\def\mdseries@tt{medium}\fi

  \ifnotomono@condensed
    \def\bfseries@tt{boldcondensed}\def\mdseries@tt{c}
    \ifnotomono@semibold\def\bfseries@tt{sbc}\fi
    \ifnotomono@extrabold\def\bfseries@tt{ebc}\fi
    \ifnotomono@black\def\bfseries@tt{ubc}\fi
    \ifnotomono@thin\def\mdseries@tt{ulc}\fi
    \ifnotomono@extralight\def\mdseries@tt{elc}\fi
    \ifnotomono@light\def\mdseries@tt{lc}\fi
    \ifnotomono@medium\def\mdseries@tt{mediumcondensed}\fi
  \else\ifnotomono@semicondensed
    \def\bfseries@tt{boldsemicondensed}\def\mdseries@tt{sc}
    \ifnotomono@semibold\def\bfseries@tt{sbsc}\fi
    \ifnotomono@extrabold\def\bfseries@tt{ebsc}\fi
    \ifnotomono@black\def\bfseries@tt{ubsc}\fi
    \ifnotomono@thin\def\mdseries@tt{ulsc}\fi
    \ifnotomono@extralight\def\mdseries@tt{elsc}\fi
    \ifnotomono@light\def\mdseries@tt{lsc}\fi
    \ifnotomono@medium\def\mdseries@rm{mediumsemicondensed}\fi
  \else\ifnotomono@extracondensed
    \def\bfseries@tt{boldextracondensed}\def\mdseries@tt{ec}
    \ifnotomono@semibold\def\bfseries@tt{sbec}\fi
    \ifnotomono@extrabold\def\bfseries@tt{ebec}\fi
    \ifnotomono@black\def\bfseries@tt{ubec}\fi
    \ifnotomono@thin\def\mdseries@tt{ulec}\fi
    \ifnotomono@extralight\def\mdseries@tt{elec}\fi
    \ifnotomono@light\def\mdseries@tt{lec}\fi
    \ifnotomono@medium\def\mdseries@rm{mediumextracondensed}\fi
  \fi\fi\fi
  
\fi

\ifnotomono@otf
  
  \def\notomono@figurestyle{Lining}
  \ifnotomono@oldstyle\def\notomono@figurestyle{OldStyle}\fi
  \def\notomono@figurealign{Monospaced}
  \ifnotomono@proportional\def\notomono@figurealign{Proportional}\fi

\fi
% type1

  \def\notomono@tonefigurestyle{LF}
  \ifnotomono@oldstyle\def\notomono@tonefigurestyle{OsF}\fi
  \def\notomono@tonefigurealign{T}
  \ifnotomono@proportional\def\notomono@tonefigurealign{}\fi

\ifnotomono@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

\ifnotomono@otf
  \def\notomono@regular{Regular}
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        HyphenChar=None, 
        Ligatures = CommonOff,
        Extension = .ttf }
  \def\notomono@Lining{Lining}
    \ifnotomono@condensed
        \setmonofont 
          [ Numbers   = {\ifx\notomono@figurestyle\notomono@Lining\else\notomono@figurestyle\fi} ,
            Scale     = \NotoSansMono@scale ,
            Ligatures = CommonOff,  % NotoSansMono has the liga feature!
            UprightFont    = *\ifx\notomono@regstyle\notomono@regular\else\notomono@regstyle\fi,
            BoldFont       = *\notomono@boldstyle ,
          ]
          {NotoSansMono-Condensed}
    \else\ifnotomono@semicondensed
        \setmonofont 
          [ Numbers   = {\ifx\notomono@figurestyle\notomono@Lining\else\notomono@figurestyle\fi} ,
            Scale     = \NotoSansMono@scale ,
            UprightFont    = *\ifx\notomono@regstyle\notomono@regular\else\notomono@regstyle\fi,
            BoldFont       = *\notomono@boldstyle ,
          ]
          {NotoSansMono-SemiCondensed}
    \else\ifnotomono@extracondensed
        \setmonofont 
          [ Numbers   = {\ifx\notomono@figurestyle\notomono@Lining\else\notomono@figurestyle\fi} ,
            Scale     = \NotoSansMono@scale ,
            UprightFont    = *\ifx\notomono@regstyle\notomono@regular\else\notomono@regstyle\fi,
            BoldFont       = *\notomono@boldstyle ,
          ]
          {NotoSansMono-ExtraCondensed}
     \else
        \setmonofont 
          [ Numbers   = {\ifx\notomono@figurestyle\notomono@Lining\else\notomono@figurestyle\fi} ,
            Scale     = \NotoSansMono@scale ,
            UprightFont    = *-\notomono@regstyle ,
            BoldFont       = *-\notomono@boldstyle , 
          ]
          {NotoSansMono}
      \fi\fi\fi
    \let\notomonofamily\ttdefault  
  \newfontfamily\notomono 
          [ Numbers   = {\ifx\notomono@figurestyle\notomono@Lining\else\notomono@figurestyle\fi} ,
            Scale     = \NotoSansMono@scale ,
            UprightFont    = *-\notomono@regstyle ,
            BoldFont       = *-\notomono@boldstyle , 
          ]
          {NotoSansMono}
  \newfontfamily\notomonocondensed
        [ Numbers   = {\ifx\notomono@figurestyle\notomono@Lining\else\notomono@figurestyle\fi} ,
          Scale     = \NotoSansMono@scale ,
          UprightFont    = *\ifx\notomono@regstyle\notomono@regular\else\notomono@regstyle\fi,
          BoldFont       = *\notomono@boldstyle ,
        ]
        {NotoSansMono-Condensed}
  \newfontfamily\notomonosemicondensed
        [ Numbers   = {\ifx\notomono@figurestyle\notomono@Lining\else\notomono@figurestyle\fi} ,
          Scale     = \NotoSansMono@scale ,
          UprightFont    = *\ifx\notomono@regstyle\notomono@regular\else\notomono@regstyle\fi,
          BoldFont       = *\notomono@boldstyle ,
        ]
        {NotoSansMono-SemiCondensed}
  \newfontfamily\notomonoextracondensed
        [ Numbers   = {\ifx\notomono@figurestyle\notomono@Lining\else\notomono@figurestyle\fi} ,
          Scale     = \NotoSansMono@scale ,
          UprightFont    = *\ifx\notomono@regstyle\notomono@regular\else\notomono@regstyle\fi,
          BoldFont       = *\notomono@boldstyle ,
        ]
        {NotoSansMono-ExtraCondensed}
   \providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}}
\else % type1
  \def\notomonofamily{NotoSansMono-T\notomono@tonefigurestyle}
  \newcommand*\notomono{\fontfamily{\notomonofamily}\selectfont}
  \newcommand*\notomonocondensed{\fontfamily{\notomonofamily}\fontseries{c}\selectfont}
  \newcommand*\notomonosemicondensed{\fontfamily{\notomonofamily}\fontseries{sc}\selectfont}
  \newcommand*\notomonoextracondensed{\fontfamily{\notomonofamily}\fontseries{ec}\selectfont}
  \def\ttdefault{\notomonofamily} 
\fi

\DeclareTextFontCommand{\textsu}{\sufigures}
\newcommand*\notomonolgr{\fontencoding{LGR}\fontfamily{NotoSansMono-T\notomono@tonefigurestyle}\selectfont}


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

\endinput