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

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifplexserif@otf 
\ifxetex
  \plexserif@otftrue
\else\ifluatex
  \plexserif@otftrue
\else  % [pdf]LaTeX
  \plexserif@otffalse
\fi\fi


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

\newif\ifplexserif@text \plexserif@textfalse
\newif\ifplexserif@textmd \plexserif@textmdfalse
\newif\ifplexserif@semibold \plexserif@semiboldfalse
\newif\ifplexserif@medium \plexserif@mediumfalse
\newif\ifplexserif@thin \plexserif@thinfalse
\newif\ifplexserif@light \plexserif@lightfalse
\newif\ifplexserif@extralight \plexserif@extralightfalse


\DeclareOptionX{type1}{\plexserif@otffalse}

\DeclareOptionX{thin}{\plexserif@thintrue}
\DeclareOptionX{t}{\plexserif@thintrue}
\DeclareOptionX{extralight}{\plexserif@extralighttrue}
\DeclareOptionX{el}{\plexserif@extralighttrue}
\DeclareOptionX{light}{\plexserif@lighttrue}
\DeclareOptionX{l}{\plexserif@lighttrue}
\DeclareOptionX{text}{\plexserif@texttrue}
\DeclareOptionX{tx}{\plexserif@texttrue}
\DeclareOptionX{textmd}{\plexserif@textmdtrue}
\DeclareOptionX{txmd}{\plexserif@textmdtrue}
\DeclareOptionX{medium}{\plexserif@mediumtrue}
\DeclareOptionX{m}{\plexserif@mediumtrue}
\DeclareOptionX{semibold}{\plexserif@semiboldtrue}
\DeclareOptionX{sb}{\plexserif@semiboldtrue}

\ProcessOptionsX\relax

\ifplexserif@otf
  \RequirePackage{fontspec}
  \def\plexserif@medstyle{Regular}
  \ifplexserif@thin\def\plexserif@medstyle{Thin}
  \else\ifplexserif@light\def\plexserif@medstyle{Light}
  \else\ifplexserif@extralight\def\plexserif@medstyle{ExtraLight}
  \else\ifplexserif@text\def\plexserif@medstyle{Text}
  \else\ifplexserif@textmd\def\plexserif@medstyle{Medium}
  \fi\fi\fi\fi\fi
  \def\plexserif@boldstyle{Bold}
  \ifplexserif@semibold\def\plexserif@boldstyle{SemiBold}
  \else\ifplexserif@medium\def\plexserif@boldstyle{Medium}
  \fi\fi
\else % type1
  \RequirePackage{fontenc,fontaxes,mweights}
  \def\mdseries@rm{m}
  \ifplexserif@thin\def\mdseries@rm{ul}
  \else\ifplexserif@light\def\mdseries@rm{l}
  \else\ifplexserif@extralight\def\mdseries@rm{el}
  \else\ifplexserif@textmd\def\mdseries@rm{text}
  \fi\fi\fi\fi

  \def\bfseries@rm{b}
  \ifplexserif@semibold\def\bfseries@rm{sb}
  \else\ifplexserif@text\def\bfseries@rm{text}
  \else\ifplexserif@medium\def\bfseries@rm{medium}
  \fi\fi\fi

  \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

\ifplexserif@otf
  \def\plexserif@regular{Regular}
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \IBMPlexSerif@scale ,
        Extension = .otf }
   \setmainfont 
      [ UprightFont    = *-\plexserif@medstyle ,
        ItalicFont     = *-\ifx\plexserif@medstyle\plexserif@regular 
                              Italic
                           \else\plexserif@medstyle Italic\fi ,
        BoldFont       = *-\plexserif@boldstyle , 
        BoldItalicFont = *-\plexserif@boldstyle Italic ]
      {IBMPlexSerif}
  \newfontfamily\plexserif
        [ UprightFont    = *-\plexserif@medstyle ,
          ItalicFont     = *-\ifx\plexserif@medstyle\plexserif@regular 
                              Italic
                           \else\plexserif@medstyle Italic\fi ,
          BoldFont       = *-\plexserif@boldstyle , 
          BoldItalicFont = *-\plexserif@boldstyle Italic ]
        {IBMPlexSerif}

\else % type1
  \def\plexseriffamily{IBMPlexSerif-TLF}
  \newcommand*\plexserif{\fontfamily{\plexseriffamily}\selectfont}
  \def\rmdefault{\plexseriffamily}
  \def\seriesdefault{\mdseries@rm}
\fi

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

\endinput