summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fira/FiraMono.sty
blob: 9f3f7aa8a3272ac442f07810ebd92696e7c18430 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{FiraMono}
    [2019/06/04 (Bob Tennent and autoinst)  Style file for Fira Mono fonts.]

% nomap option suggested by Harlan Lieberman-Berg (hlieberm@akamai.com) 2016-02-11

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\iffiramono@otf 
\ifxetex
  \firamono@otftrue
\else\ifluatex
  \firamono@otftrue
\else  % [pdf]LaTeX
  \firamono@otffalse
\fi\fi

\newif\iffiramono@lining \firamono@liningfalse

\newif\iffiramono@medium  \firamono@mediumfalse
\newif\iffiramono@ligatures \firamono@ligaturestrue

\newcommand*{\FiraMono@scale}{1}
\RequirePackage{xkeyval}
\DeclareOptionX{scaled}{\renewcommand*{\FiraMono@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\FiraMono@scale}{#1}}
\DeclareOptionX{type1}{\firamono@otffalse}
\DeclareOptionX{lining}{\firamono@liningtrue}
\DeclareOptionX{lf}{\firamono@liningtrue}
\DeclareOptionX{oldstyle}{\firamono@liningfalse}
\DeclareOptionX{osf}{\firamono@liningfalse}
\DeclareOptionX{nomap}{\firamono@ligaturesfalse}

\DeclareOptionX{medium}{\firamono@mediumtrue}
\DeclareOptionX{mb}{\firamono@mediumtrue}

\ProcessOptionsX

\iffiramono@otf
  \iffiramono@lining
    \def\firamono@otffigurestyle{Tabular}
  \else
    \def\firamono@otffigurestyle{OldStyle} 
  \fi
\fi

\iffiramono@lining
  \def\firamono@figurestyle{LF}
\else
  \def\firamono@figurestyle{OsF}
\fi

\iffiramono@otf
  \def\firamono@boldstyle{Bold}
  \def\firamono@regstyle{Regular}
  \iffiramono@medium\def\firamono@boldstyle{Medium}\fi

\else % type1

  \def\bfseries@tt{bold}
  \def\mdseries@tt{regular}
  \iffiramono@medium\def\bfseries@tt{medium}\fi
\fi


\iffiramono@otf
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,mweights,fontaxes}
\fi

\iffiramono@otf
  \ifxetex\XeTeXtracingfonts=1\fi
  \iffiramono@ligatures
    \defaultfontfeatures{
          Ligatures = TeX ,
          HyphenChar=None,
          Scale     = \FiraMono@scale ,
          Extension = .otf }
  \else
    \defaultfontfeatures{
          Scale     = \FiraMono@scale ,
          HyphenChar=None,
          Extension = .otf }
  \fi
  \def\firamono@regular{Regular}
  \setmonofont
      [ Numbers = {Monospaced,\firamono@otffigurestyle},
        UprightFont    = *-\firamono@regstyle ,
        ItalicFont     = *-\ifx\firamono@regstyle\firamono@regular Oblique\else\firamono@regstyle Oblique\fi ,
        BoldFont    = *-\firamono@boldstyle ,
        BoldItalicFont     = *-\firamono@boldstyle Oblique,
      ]
      {FiraMono}
  % grab current family in case of subsequent change:
  \let\firamonofamily\sfdefault  

  \providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}}
  \newfontfamily\firamonooldstyle
      [ Numbers = {Monospaced,OldStyle},
        UprightFont    = *-\firamono@regstyle ,
        ItalicFont     = *-\ifx\firamono@regstyle\firamono@regular Oblique\else\firamono@regstyle Oblique\fi ,
        BoldFont    = *-\firamono@boldstyle ,
        BoldItalicFont     = *-\firamono@boldstyle Oblique,
      ]
      {FiraMono}
  \newfontfamily\firamonolining
      [ Numbers = {Monospaced,Tabular},
        UprightFont    = *-\firamono@regstyle ,
        ItalicFont     = *-\ifx\firamono@regstyle\firamono@regular Oblique\else\firamono@regstyle Oblique\fi ,
        BoldFont    = *-\firamono@boldstyle ,
        BoldItalicFont     = *-\firamono@boldstyle Oblique,
      ]
      {FiraMono}
  \newfontfamily\firamonomedium
      [ Numbers = {Monospaced,\firamono@otffigurestyle},
        UprightFont    = *-Medium ,
        ItalicFont     = *-\ifx\firamono@regstyle\firamono@regular Oblique\else\firamono@regstyle Oblique\fi ,
        BoldFont    = *-\firamono@boldstyle ,
        BoldItalicFont     = *-\firamono@boldstyle Oblique,
      ]
      {FiraMono}

\else % type1

  \def\firamono@family{FiraMono-T\firamono@figurestyle}
  \def\ttdefault{\firamono@family}
  \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
  \def\sufigures{\@nomath\sufigures\fontfigurestyle{superior}\selectfont}

  \def\firamonooldstyle{\fontfamily{FiraMono-TOsF}\selectfont}
  \def\firamonolining{\fontfamily{FiraMono-TLF}\selectfont}

  \def\firamonomedium{\fontfamily{\firamono@family}\fontseries{medium}\selectfont}
\fi

%  Use FiraMono-... as the family, even for otf
\def\firamonolgr{\fontencoding{LGR}\fontfamily{FiraMono-T\fira@figurestyle}\selectfont}

\iffiramono@otf
  \defaultfontfeatures{}
\fi

\endinput