summaryrefslogtreecommitdiff
path: root/fonts/plex/latex/plex-mono.sty
diff options
context:
space:
mode:
Diffstat (limited to 'fonts/plex/latex/plex-mono.sty')
-rw-r--r--fonts/plex/latex/plex-mono.sty101
1 files changed, 101 insertions, 0 deletions
diff --git a/fonts/plex/latex/plex-mono.sty b/fonts/plex/latex/plex-mono.sty
new file mode 100644
index 0000000000..3f6b7702d4
--- /dev/null
+++ b/fonts/plex/latex/plex-mono.sty
@@ -0,0 +1,101 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{plex-mono}
+ [2019/06/01 (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 ,
+ HyphenChar=None,
+ 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