summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ebgaramond/ebgaramond.sty
blob: f8c2c8edb2704bbd15c9029a45351725a0d581ab (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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ebgaramond}
    [2013/02/19 (Bob Tennent and autoinst)  Style file for EB Garamond fonts.]

\RequirePackage{ifxetex,ifluatex,xkeyval,textcomp}

\newif\ifebgaramond@otf 
\ifxetex
  \ebgaramond@otftrue
\else\ifluatex
  \ebgaramond@otftrue
\else  % [pdf]LaTeX
  \ebgaramond@otffalse
\fi\fi

\newif\ifebgaramond@lining \ebgaramond@liningfalse
\newif\ifebgaramond@tabular \ebgaramond@tabularfalse

\newcommand*{\EBGaramond@scale}{1}
\RequirePackage{xkeyval}
\DeclareOptionX{scaled}{\renewcommand*{\EBGaramond@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\EBGaramond@scale}{#1}}
\DeclareOptionX{type1}{\ebgaramond@otffalse}
\DeclareOptionX{lining}{\ebgaramond@liningtrue}
\DeclareOptionX{nf}{\ebgaramond@liningtrue}
\DeclareOptionX{lf}{\ebgaramond@liningtrue}
\DeclareOptionX{oldstyle}{\ebgaramond@liningfalse}
\DeclareOptionX{osf}{\ebgaramond@liningfalse}
\DeclareOptionX{tabular}{\ebgaramond@tabulartrue}
\DeclareOptionX{t}{\ebgaramond@tabulartrue}
\DeclareOptionX{proportional}{\ebgaramond@tabularfalse}
\DeclareOptionX{p}{\ebgaramond@tabularfalse}


\ExecuteOptionsX{oldstyle,proportional}
\ProcessOptionsX\relax

\ifebgaramond@otf
  \ifebgaramond@lining
    \def\ebgaramond@figurestyle{Lining}
  \else
    \def\ebgaramond@figurestyle{OldStyle} 
  \fi
  \ifebgaramond@tabular
    \def\ebgaramond@figurealign{Monospaced} 
  \else
    \def\ebgaramond@figurealign{Proportional} 
  \fi
\else % type1
  \ifebgaramond@lining
    \def\ebgaramond@figurestyle{LF}
  \else
    \def\ebgaramond@figurestyle{OsF}
  \fi
  \ifebgaramond@tabular
    \def\ebgaramond@figurealign{T}
  \else
    \def\ebgaramond@figurealign{}
  \fi
\fi

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

\ifebgaramond@otf
  \ifxetex\XeTeXtracingfonts=1\fi
  \defaultfontfeatures{
        Ligatures = TeX ,
        Scale     = \EBGaramond@scale ,
        Extension = .otf }
  \setmainfont
      [ Numbers = {\ebgaramond@figurealign,\ebgaramond@figurestyle},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
      ]
      {EBGaramond12}
  \newfontfamily\ebgaramond
      [ Numbers = {\ebgaramond@figurealign,\ebgaramond@figurestyle},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
      ]
      {EBGaramond12}
  \providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}}
  \newfontfamily\swshape
      [ Style={Swash},
        Numbers = {\ebgaramond@figurealign,\ebgaramond@figurestyle},
        UprightFont    = *-Italic ,
        ItalicFont     = *-Italic ,
      ]
      {EBGaramond12}
  \newfontfamily\ebgaramondOsF
      [ Numbers = {\ebgaramond@figurealign,OldStyle},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
      ]
      {EBGaramond12}
  \newfontfamily\ebgaramondLF
      [ Numbers = {\ebgaramond@figurealign,Lining},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
      ]
      {EBGaramond12}
  \newfontface\ebgaramond@initials{EBGaramond-Initials}
  \DeclareTextFontCommand{\oldstylenums}{\ebgaramondOsF}
  \DeclareTextFontCommand{\liningnums}{\ebgaramondLF}
  \DeclareTextFontCommand{\textin}{\ebgaramond@initials}

\else % type1

  \def\ebgaramond@family{EBGaramond-\ebgaramond@figurealign\ebgaramond@figurestyle}
  \renewcommand*\rmdefault{\ebgaramond@family}
  \renewcommand*\bfdefault{m}
  \newcommand*\ebgaramond{\fontfamily{\ebgaramond@family}\selectfont}

  \DeclareRobustCommand\swshape{\not@math@alphabet\swshape\relax
      \fontprimaryshape\itdefault\fontsecondaryshape\swdefault\selectfont}
  \fa@naming@exception{shape}{{n}{sw}}{nw}
  \fa@naming@exception{shape}{{it}{sw}}{sw}

  \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
  \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
  \def\sufigures{\@nomath\sufigures\fontfigurestyle{superior}\selectfont}

  \def\initials{\fontfamily{EBGaramondInitials-TLF}\selectfont}

  \DeclareTextFontCommand{\oldstylenums}{\fontfamily{EBGaramond-\ebgaramond@figurealign OsF}\selectfont}
  \DeclareTextFontCommand{\liningnums}{\fontfamily{EBGaramond-\ebgaramond@figurealign LF}\selectfont}
  \DeclareTextFontCommand{\textin}{\fontfamily{EBGaramondInitials-TLF}\selectfont}

\fi

\DeclareTextFontCommand{\textsu}{\sufigures}
\DeclareTextFontCommand{\textsw}{\swshape}

\ifebgaramond@otf
  \newfontfamily\ebgaramondtabular
    [ Numbers = {Monospaced,\ebgaramond@figurestyle},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
    ]
    {EBGaramond12}
  \newfontfamily\ebgaramondproportional
    [ Numbers = {Proportional,\ebgaramond@figurestyle},
        UprightFont    = *-Regular ,
        ItalicFont     = *-Italic ,
    ]
    {EBGaramond12}
  \DeclareTextFontCommand{\tabularnums}{\ebgaramondtabular}
  \DeclareTextFontCommand{\proportionalnums}{\ebgaramondproportional}
\else % type1
  \DeclareTextFontCommand{\tabularnums}{\fontfamily{EBGaramond-T\ebgaramond@figurestyle}\selectfont}
  \DeclareTextFontCommand{\proportionalnums}{\fontfamily{EBGaramond-\ebgaramond@figurestyle}\selectfont}
\fi

\def\EBGaramond@MT@Hook{%
  \DeclareMicrotypeAlias{EBGaramond-LF}{EBGaramond}
  \DeclareMicrotypeAlias{EBGaramond-OsF}{EBGaramond}
  \DeclareMicrotypeAlias{EBGaramond-Sup}{EBGaramond}
  \DeclareMicrotypeAlias{EBGaramond-TLF}{EBGaramond}
  \DeclareMicrotypeAlias{EBGaramond-TOsF}{EBGaramond}
  \DeclareMicrotypeAlias{EBGaramondInitials-TLF}{EBGaramondInitials}
}
\@ifpackageloaded{microtype}
{\EBGaramond@MT@Hook}
{\@ifundefined{Microtype@Hook}
  {\let\Microtype@Hook\EBGaramond@MT@Hook}
  {\g@addto@macro\Microtype@Hook{\EBGaramond@MT@Hook}}} 

\renewcommand{\bfdefault}{m}


\ifebgaramond@otf
  \defaultfontfeatures{}
\fi

\endinput