summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/plex/plex-mono.sty
blob: 32e19ea2588bfb5179ecf1e97a5217c114cf5899 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{plex-mono}
    [2019/04/23  (Bob Tennent) Style file for IBMPlexMono fonts]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifplexmono@otf 
\ifxetex
  \plexmono@otftrue
\else\ifluatex
  \plexmono@otftrue
\else  % [pdf]LaTeX
  \plexmono@otffalse
\fi\fi


\newcommand*{\IBMPlexMono@scale}{1}
\DeclareOptionX{scale}{\renewcommand*{\IBMPlexMono@scale}{#1}}

\newif\ifplexmono@ligatures \plexmono@ligaturestrue


\DeclareOptionX{type1}{\plexmono@otffalse}

\DeclareOptionX{thin}{\edef\mdseries@tt{t}\def\plexmono@medstyle{Thin}}
\DeclareOptionX{t}{\edef\mdseries@tt{t}\def\plexmono@medstyle{Thin}}
\DeclareOptionX{extralight}{\edef\mdseries@tt{el}\def\plexmono@medstyle{ExtraLight}}
\DeclareOptionX{el}{\edef\mdseries@tt{el}\def\plexmono@medstyle{ExtraLight}}
\DeclareOptionX{light}{\edef\mdseries@tt{l}\def\plexmono@medstyle{Light}}
\DeclareOptionX{l}{\edef\mdseries@tt{l}\def\plexmono@medstyle{Light}}
\DeclareOptionX{textmd}{\edef\mdseries@tt{tx}\def\plexserif@medstyle{Text}}
\DeclareOptionX{txmd}{\edef\mdseries@tt{tx}\def\plexserif@medstyle{Text}}
\DeclareOptionX{text}{\edef\bfseries@tt{tx}\def\plexmono@boldstyle{Text}}
\DeclareOptionX{tx}{\edef\bfseries@tt{tx}\def\plexmono@boldstyle{Text}}
\DeclareOptionX{medium}{\edef\bfseries@tt{mb}\def\plexmono@boldstyle{Medium}}
\DeclareOptionX{m}{\edef\bfseries@tt{mb}\def\plexmono@boldstyle{Medium}}
\DeclareOptionX{semibold}{\edef\bfseries@tt{sb}\def\plexmono@boldstyle{SemiBold}}
\DeclareOptionX{sb}{\edef\bfseries@tt{sb}\def\plexmono@boldstyle{SemiBold}}
\DeclareOptionX{nomap}{\plexmono@ligaturesfalse}

\ProcessOptionsX\relax

\ifplexmono@otf
  \RequirePackage{fontspec}
  \def\plexmono@medstyle{Regular}
  \def\plexmono@boldstyle{Bold}
\else % type1
  \RequirePackage{fontenc,fontaxes,mweights}
  \def\bfseries@tt{b}
  \def\mdseries@tt{m}
  \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
  \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
  \def\sufigures{\@nomath\sufigures
      \fontfigurestyle{superior}\selectfont}
  \DeclareTextFontCommand{\textsu}{\sufigures}
  \let\textsuperior\textsu
\fi

\ifplexmono@otf
  \def\plexmono@regular{Regular}
  \ifxetex\XeTeXtracingfonts=1\fi
  \ifplexmono@ligatures
    \defaultfontfeatures{
          Ligatures = TeX ,
          Scale     = \IBMPlexMono@scale ,
          Extension = .otf }
  \else
    \defaultfontfeatures{
          Scale     = \IBMPlexMono@scale ,
          Extension = .otf }
  \fi
  \setmonofont 
      [ UprightFont    = *-\plexmono@medstyle ,
        ItalicFont     = *-\ifx\plexmono@medstyle\plexmono@regular 
                              Italic
                           \else\plexmono@medstyle Italic\fi ,
        BoldFont       = *-\plexmono@boldstyle , 
        BoldItalicFont = *-\plexmono@boldstyle Italic ]
      {IBMPlexMono}
  \newfontfamily\plexmono
        [ UprightFont    = *-\plexmono@medstyle ,
          ItalicFont     = *-\ifx\plexmono@medstyle\plexmono@regular 
                              Italic
                           \else\plexmono@medstyle Italic\fi ,
          BoldFont       = *-\plexmono@boldstyle , 
          BoldItalicFont = *-\plexmono@boldstyle Italic ]
        {IBMPlexMono}

\else % type1
  \def\plexmonofamily{IBMPlexMono-TLF}
  \newcommand*\plexmono{\fontfamily{\plexmonofamily}\selectfont}
  \def\ttdefault{\plexmonofamily}
\fi

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

\endinput