summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bitter/bitter.sty
blob: 1362c92640dcb67a8c5ff805967183b2b59f0d11 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bitter}
    [2019/05/10 (R.D. Tennent)  Supports Bitter fonts for all LaTeX engines.]

\RequirePackage{ifxetex,ifluatex,textcomp}

\newif\ifBitter@ttf
\ifxetex
  \Bitter@ttftrue
\else\ifluatex
  \Bitter@ttftrue
\else  % [pdf]LaTeX
  \Bitter@ttffalse
\fi\fi

\newcommand*{\Bitter@scale}{1}  
\RequirePackage{xkeyval}
\DeclareOptionX{scaled}{\renewcommand*{\Bitter@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\Bitter@scale}{#1}}

\DeclareOptionX{type1}{\Bitter@ttffalse}

\ProcessOptionsX\relax

\ifBitter@ttf
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,fontaxes,mweights}
\fi

\ifBitter@ttf
  \def\Bitter@regular{Regular}
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
     Ligatures = TeX ,
     Extension = .ttf ,
     Scale     = \Bitter@scale ,
  }
  \setmainfont
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
      ]
      {Bitter}
  % grab current family in case of subsequent change:
  \let\Bitterfamily\rmdefault 

  \newfontfamily\bitter
      [ UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
        BoldFont       = *-Bold , 
      ]
      {Bitter}

\else % type1

  \def\bfseries@rm{b}
  \def\mdseries@rm{m}
  \def\seriesdefault{\mdseries@rm}
  \def\bitterfamily{Bitter-TLF}
  \def\bitter{\fontfamily{\bitterfamily}\selectfont}
  \def\rmdefault{\bitterfamily}

\fi

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

\endinput