summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/plex/plex-sans.sty
blob: 46e0bb58141cea7e7c3decde5a43a5ecc34d1149 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{plex-sans}
    [2018/08/01  (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}
\newcommand*{\IBMPlexSansCondensed@scale}{1}
\DeclareOptionX{scale}{\renewcommand*{\IBMPlexSans@scale}{#1}\renewcommand*{\IBMPlexSansCondensed@scale}{#1}}

\newif\ifplexsans@sfdefault \plexsans@sfdefaultfalse
\newif\ifplexsans@condensed \plexsans@condensedfalse

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

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


\ProcessOptionsX\relax


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

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



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

\endinput