summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/plex/plex-sans.sty
blob: a05630477a3375ff697f51cf43784e931c603ea7 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{plex-sans}
    [2017/11/13  (Bob Tennent) Style file for IBMPlexSans fonts]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifplexsans@otf 
\ifxetex
  \plexsans@otftrue
\else\ifluatex
  \plexsans@otftrue
\else  % [pdf]LaTeX
  \plexsans@otffalse
\fi\fi

\ifplexsans@otf
  \RequirePackage{fontspec}
  \def\plexsans@medstyle{Regular}
  \def\plexsans@boldstyle{Bold}
\else % type1
  \RequirePackage{fontenc,fontaxes,mweights}
  \def\bfseries@sf{b}
  \def\mdseries@sf{m}
  \def\plexsans@figurestyle{LF}
  \def\plexsans@figurealign{T}
  \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

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


\newif\ifplexsans@sfdefault \plexsans@sfdefaultfalse

\DeclareOptionX{type1}{\plexsans@otffalse}
\DeclareOptionX{sfdefault}{\plexsans@sfdefaulttrue}

\DeclareOptionX{thin}{\edef\mdseries@rm{t}\def\plexsans@medstyle{Thin}}
\DeclareOptionX{t}{\edef\mdseries@rm{t}\def\plexsans@medstyle{Thin}}
\DeclareOptionX{extralight}{\edef\mdseries@rm{el}\def\plexsans@medstyle{ExtraLight}}
\DeclareOptionX{el}{\edef\mdseries@rm{el}\def\plexsans@medstyle{ExtraLight}}
\DeclareOptionX{light}{\edef\mdseries@rm{l}\def\plexsans@medstyle{Light}}
\DeclareOptionX{l}{\edef\mdseries@rm{l}\def\plexsans@medstyle{Light}}
\DeclareOptionX{text}{\edef\bfseries@rm{tx}\def\plexsans@boldstyle{Text}}
\DeclareOptionX{tx}{\edef\bfseries@rm{tx}\def\plexsans@boldstyle{Text}}
\DeclareOptionX{medium}{\edef\bfseries@rm{mb}\def\plexsans@boldstyle{Medium}}
\DeclareOptionX{m}{\edef\bfseries@rm{mb}\def\plexsans@boldstyle{Medium}}
\DeclareOptionX{semibold}{\edef\bfseries@rm{sb}\def\plexsans@boldstyle{SemiBold}}
\DeclareOptionX{sb}{\edef\bfseries@rm{sb}\def\plexsans@boldstyle{SemiBold}}


\ProcessOptionsX\relax


\ifplexsans@otf
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
      Ligatures = TeX ,
      Scale     = \IBMPlexSans@scale ,
      Extension = .otf }
   \setsansfont 
      [ UprightFont    = *-\plexsans@medstyle ,
        ItalicFont     = *-\plexsans@medstyle Italic ,
        BoldFont       = *-\plexsans@boldstyle , 
        BoldItalicFont = *-\plexsans@boldstyle Italic ]
      {IBMPlexSans}
  \let\plexsansfamily\sfdefault
  \newfontfamily\plexsans
      [ UprightFont    = *-\plexsans@medstyle ,
        ItalicFont     = *-\plexsans@medstyle Italic ,
        BoldFont       = *-\plexsans@boldstyle , 
        BoldItalicFont = *-\plexsans@boldstyle Italic ]
        {IBMPlexSans}
  \ifplexsans@sfdefault\renewcommand*\familydefault{\plexsansfamily}\fi


\else % type1
  \def\plexsansfamily{IBMPlexSans-\plexsans@figurealign\plexsans@figurestyle}
  \newcommand*\plexsans{\fontfamily{\plexsansfamily}\selectfont}
  \def\sfdefault{\plexsansfamily}
  \ifplexsans@sfdefault\edef\familydefault{\sfdefault}\fi
\fi

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

\endinput