summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/plex/plex-serif.sty
blob: 707fa1336236eabeca8c63e6ca7bed02997ef20f (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{plex-serif}
    [2017/11/13  (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

\ifplexserif@otf
  \RequirePackage{fontspec}
  \def\plexserif@medstyle{Regular}
  \def\plexserif@boldstyle{Bold}
\else % type1
  \RequirePackage{fontenc,fontaxes,mweights}
  \def\bfseries@rm{b}
  \def\mdseries@rm{m}
  \def\plexserif@figurestyle{LF}
  \def\plexserif@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*{\IBMPlexSerif@scale}{1}
\DeclareOptionX{scale}{\renewcommand*{\IBMPlexSerif@scale}{#1}}


\DeclareOptionX{type1}{\plexserif@otffalse}

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

\ProcessOptionsX\relax


\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-\plexserif@figurealign\plexserif@figurestyle}
  \newcommand*\plexserif{\fontfamily{\plexseriffamily}\selectfont}
  \def\rmdefault{\plexseriffamily}
\fi

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

\endinput