summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fira/FiraMono.sty
blob: db1c25bf109705650f42890ebb6da955a952cf40 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{FiraMono}
    [2019/04/22 (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 ,
          Scale     = \FiraMono@scale ,
          Extension = .otf }
  \else
    \defaultfontfeatures{
          Scale     = \FiraMono@scale ,
          Extension = .otf }
  \fi
  \setmonofont
      [ Numbers = {Monospaced,\firamono@otffigurestyle},
        UprightFont    = *-\firamono@regstyle ,
        ItalicFont     = *-\firamono@regstyle ,
        BoldFont    = *-\firamono@boldstyle ,
        BoldItalicFont     = *-\firamono@boldstyle ,
      ]
      {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     = *-\firamono@regstyle ,
        BoldFont    = *-\firamono@boldstyle ,
        BoldItalicFont     = *-\firamono@boldstyle ,
      ]
      {FiraMono}
  \newfontfamily\firamonolining
      [ Numbers = {Monospaced,Tabular},
        UprightFont    = *-\firamono@regstyle ,
        ItalicFont     = *-\firamono@regstyle ,
        BoldFont    = *-\firamono@boldstyle ,
        BoldItalicFont     = *-\firamono@boldstyle ,
      ]
      {FiraMono}
  \newfontfamily\firamonomedium
      [ Numbers = {Monospaced,\firamono@otffigurestyle},
        UprightFont    = *-Medium ,
        ItalicFont     = *-Medium ,
        BoldFont    = *-\firamono@boldstyle ,
        BoldItalicFont     = *-\firamono@boldstyle ,
      ]
      {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