summaryrefslogtreecommitdiff
path: root/fonts/atkinson/latex/atkinson.sty
blob: d9b0acdc99baa1efc650b1f2d7e0e249275f80c9 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{atkinson}
    [2022/09/14 (Bob Tennent)  Supports Atkinson Hyperlegible fonts for all LaTeX engines.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifatkinson@otf 
\ifxetex
  \atkinson@otftrue
\else\ifluatex
  \atkinson@otftrue
\else  % [pdf]LaTeX
  \atkinson@otffalse
\fi\fi

\newif\ifatkinson@tabular \atkinson@tabularfalse
\newif\ifatkinson@default \atkinson@defaultfalse

\newcommand*{\atkinsn@scale}{1}
\DeclareOptionX{scaled}{\renewcommand*{\atkinsn@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\atkinsn@scale}{#1}}

\DeclareOptionX{default}{\atkinson@defaulttrue}
\DeclareOptionX{sfdefault}{\atkinson@defaulttrue}
\DeclareOptionX{type1}{\atkinson@otffalse}
\DeclareOptionX{t}{\atkinson@tabulartrue}
\DeclareOptionX{proportional}{\atkinson@tabularfalse}
\DeclareOptionX{p}{\atkinson@tabularfalse}


\ExecuteOptionsX{proportional}
\ProcessOptionsX\relax

\ifatkinson@otf
  \def\atkinson@boldstyle{Bold}
  \def\atkinson@regstyle{Regular}

\else % type1

  \def\mdseries@sf{m}
  \def\bfseries@sf{b}

\fi

\ifatkinson@otf
  \ifatkinson@tabular
    \def\atkinson@figurealign{Monospaced} 
  \else
    \def\atkinson@figurealign{Proportional} 
  \fi
\else % type1
  \ifatkinson@tabular
    \def\atkinson@figurealign{T}
  \else
    \def\atkinson@figurealign{}
  \fi


\fi


\ifatkinson@otf
  \RequirePackage{fontspec}
\else
  \RequirePackage{fontenc,fontaxes,mweights}
\fi

\ifatkinson@otf
  \def\atkinson@regular{Regular}
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \atkinsn@scale ,
        Extension = .otf }
    \setsansfont
        [ Numbers = {\atkinson@figurealign},
          UprightFont    = *-\atkinson@regstyle-102 ,
          ItalicFont     = *-\ifx\atkinson@regstyle\atkinson@regular Italic\else\atkinson@regstyle Italic\fi-102,
          BoldFont       = *-\atkinson@boldstyle-102 ,
          BoldItalicFont = *-\atkinson@boldstyle Italic-102 ,
        ]
        {Atkinson-Hyperlegible}
  % grab current family in case of subsequent change:
  \let\atkinsonfamily\sfdefault  
  \ifatkinson@default\renewcommand*\familydefault{\atkinsonfamily}\fi
  \newfontfamily\atkinson
        [ Numbers = {\atkinson@figurealign},
          UprightFont    = *-\atkinson@regstyle-102 ,
          ItalicFont     = *-\ifx\atkinson@regstyle\atkinson@regular Italic\else\atkinson@regstyle Italic\fi-102,
          BoldFont       = *-\atkinson@boldstyle-102 ,
          BoldItalicFont = *-\atkinson@boldstyle Italic-102 ,
        ]
        {Atkinson-Hyperlegible}
    \newfontfamily\atkinsonlf
        [ Numbers = {Proportional},
          UprightFont    = *-\atkinson@regstyle-102 ,
          ItalicFont     = *-\ifx\atkinson@regstyle\atkinson@regular Italic\else\atkinson@regstyle Italic\fi-102,
          BoldFont       = *-\atkinson@boldstyle-102 ,
          BoldItalicFont = *-\atkinson@boldstyle Italic-102 ,
        ]
        {Atkinson-Hyperlegible}
    \newfontfamily\atkinsontlf
        [ Numbers = {Monospaced},
          UprightFont    = *-\atkinson@regstyle-102 ,
          ItalicFont     = *-\ifx\atkinson@regstyle\atkinson@regular Italic\else\atkinson@regstyle Italic\fi-102,
          BoldFont       = *-\atkinson@boldstyle-102 ,
          BoldItalicFont = *-\atkinson@boldstyle Italic-102 ,
        ]
        {Atkinson-Hyperlegible}

\else % type1
  \def\atkinsonfamily{atkinsn-\atkinson@figurealign LF}
  \newcommand*\atkinson{\fontfamily{\atkinsonfamily}\selectfont}
  \def\sfdefault{\atkinsonfamily}
  \ifatkinson@default\edef\familydefault{\sfdefault}\edef\seriesdefault{\mdseries@sf}\fi
  \def\atkinsontlf{\fontfamily{atkinsn-TLF}\selectfont}
  \def\atkinsonlf{\fontfamily{atkinsn-LF}\selectfont}

\fi

\DeclareTextFontCommand{\atkinsonTLF}{\atkinsontlf}
\DeclareTextFontCommand{\atkinsonLF}{\atkinsonlf}

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

\endinput