summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/berenisadf/berenis.sty
blob: 7d855d25614aec6313cffb6f70c593187782fca4 (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
%% Copyright 2013 Clea F. Rees
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Clea F. Rees.
%
% This work consists of all files listed in manifest.txt.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{berenis}[2013/11/20 v2.0 berenis]
\RequirePackage{xkeyval}
\RequirePackage{nfssext-cfr}
\newif\ifberenis@ly
%:boolkeys for ligature/swash encoding as default
\define@boolkey{berenis.sty}[berenis@]{lig}[true]{%
	\ifberenis@lig
		\def\berenis@lig{w}%
		\def\berenis@enc{LY1}%
		\berenis@lytrue
	\else
		\def\berenis@lig{}%
		\berenis@lyfalse
	\fi}
%:boolkeys for roman osf/lf
\define@boolkey{berenis.sty}[berenis@]{osf}[true]{%
	\ifberenis@osf
		\def\berenis@lfosf{j}%
	\else
		\def\berenis@lfosf{}%
	\fi}
\define@boolkey{berenis.sty}[berenis@]{lf}[true]{%
	\ifberenis@lf
		\def\berenis@lfosf{}%
	\else
		\def\berenis@lfosf{j}%
	\fi}
%:boolkeys for roman prop/tab
\define@boolkey{berenis.sty}[berenis@]{prop}[true]{%
	\ifberenis@prop
		\def\berenis@tabprop{2}%
	\else
		\def\berenis@tabprop{}%
	\fi}
\define@boolkey{berenis.sty}[berenis@]{tab}[true]{%
	\ifberenis@tab
		\def\berenis@tabprop{}%
	\else
		\def\berenis@tabprop{2}%
	\fi}
\define@boolkey{berenis.sty}[berenis@]{lm}[true]{%
	\ifberenis@lm
		\relax
	\else
		\PackageWarning{berenis.sty}{%
			Default sf and tt families will not\MessageBreak
			be changed to Latin Modern.\MessageBreak
			If you use the LY1 font encoding, \MessageBreak
			you should change the defaults\MessageBreak
			yourself since Computer Modern\MessageBreak
			does not support LY1.\MessageBreak}%
	\fi}
\define@choicekey*+{berenis.sty}{enc}[\benc\bencno]{ly1,t1}{%
	\ifcase\bencno\relax
		\def\berenis@enc{LY1}%
		\berenis@lytrue
	\or
		\def\berenis@enc{T1}%
		\def\berenis@lig{}%
		\berenis@lyfalse
	\fi}{%
		\PackageWarning{berenis.sty}{#1 is not a supported font encoding. Please see the package documentation for details.}%
	}%
%:defaults to ensure everything is defined to something
\ExecuteOptionsX{lig=false,osf=true,prop=true,lm=true,enc=ly1}
%:options override defaults
\ProcessOptionsX
\RequirePackage[\berenis@enc]{fontenc}
%:make BerenisADFPro default roman font, implementing options for ligature/swash encoding and lf/osf as applicable
\renewcommand{\rmdefault}{ybd\berenis@tabprop\berenis@lfosf\berenis@lig}
\ifberenis@lm
	\renewcommand{\sfdefault}{lmss}
	\renewcommand{\ttdefault}{lmtt}
\fi
\newcommand*{\berenis@rhybudd}[2]{\PackageWarning{berenis.sty}{#1 unavailable.\MessageBreak #2 used instead.\MessageBreak}}%
%:based on definition of \ss from afm2pl manual page
\def\zeroslash{%
	\ifberenis@ly
		\setbox0\hbox{\char184}%
		\setbox1\hbox{\char24}%
		\ifnum\wd0=\wd1 \char48\berenis@rhybudd{slashed zero}{zero}\else\ifnum\wd0=0 \char48\berenis@rhybudd{slashed zero}{zero}\else\char184\fi\fi
	\else
		\char48\berenis@rhybudd{slashed zero}{zero}%
	\fi}
%:experiment: even if this works, it is a horrible kludge
%\gdef\berenis@ligswash{w}%
%\def\berenis@Q{ Q}%
%\def\berenis@get@vff#1#2#3#4\@nil{#1#2#3}%
%\def\berenis@get@variants ybd#1\@nil{#1}%
%\def\berenis@cyntaf@variant#1#2\@nil{#1}%
%\def\berenis@ail@variant#1#2\@nil{#2}%
%\newcommand*{\berenis@variants}[1]{%
%	\edef\tempz{#1}%
%	\def\tempe{}%
%	\ifx\tempz\tempe
%		\gdef\berenis@olaf{}%
%	\else
%		\edef\tempb{\expandafter\berenis@cyntaf@variant#1 Q\@nil}%
%		\edef\tempc{\expandafter\berenis@ail@variant#1 Q\@nil}%
%		\edef\tempd{\expandafter\berenis@ail@variant#1\@nil}%
%		\ifx\tempc\berenis@Q \gdef\berenis@olaf{\tempb}\else\berenis@variants{\tempd}\fi
%	\fi
%	}
%\newcommand*{\berenis@teulu}{%
%	\edef\tempf{\expandafter\berenis@get@vff\f@family\@nil}%
%	\def\tempybd{ybd}%
%	\ifx\tempf\tempybd
%		\edef\tempa{\expandafter\berenis@get@variants\f@family\@nil}%
%		\berenis@variants{\tempa}%
%	\else
%		\gdef\berenis@olaf{}%
%	\fi}
% Get proper tai bach for W, w, Y, y (Ideally would set further stuff but these are the most problematic.
% In version 1.0, this only worked in the swash variants. In version 2.0, it works for any LY1 encoding.
% The cost is some of the non-fancy non-standard ligatures and the boundary character in the non-swash variants.
\ifberenis@ly
	\DeclareTextCompositeCommand{\^}{LY1}{W}{%
%		\berenis@teulu
%		\edef\tempx{\berenis@ligswash}%
%		\edef\tempy{\berenis@olaf}%
%		\ifx\tempx\tempy \char9 \else\accent94\char87\fi
		\char9}
	\DeclareTextCompositeCommand{\^}{LY1}{w}{%
%		\berenis@teulu
%		\edef\tempx{\berenis@ligswash}%
%		\edef\tempy{\berenis@olaf}%
%		\ifx\tempx\tempy \char3 \else\accent94\char119\fi
		\char3}
	\DeclareTextCompositeCommand{\^}{LY1}{Y}{%
%		\berenis@teulu
%		\edef\tempx{\berenis@ligswash}%
%		\edef\tempy{\berenis@olaf}%
%		\ifx\tempx\tempy \char10 \else\accent94\char89\fi
		\char10}
	\DeclareTextCompositeCommand{\^}{LY1}{y}{%
%		\berenis@teulu
%		\edef\tempx{\berenis@ligswash}%
%		\edef\tempy{\berenis@olaf}%
%		\ifx\tempx\tempy \char13 \else\accent94\char121\fi
		\char13}
\else
	\RequirePackage{textcomp}
\fi
\endinput
%% end berenis.sty