summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/inconsolata/zi4.sty
blob: 8e6b8d66f0b15d628e828db3b7116ac0789d8c97 (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
% Copyright 2014--2019 Michael Sharpe
% Based initially on Karl Berry's inconsolata.sty.
% You may freely use, modify and/or distribute this file.

\def\fileversion{1.12}
\def\filedate{2019/05/17}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zi4}[\filedate\space v\fileversion]
\message{`inconsolata-zi4' v\fileversion, \filedate\space Text macros for Inconsolata (msharpe)}

\RequirePackage{textcomp}
\RequirePackage{xkeyval}

\newcount\zifour@ocount
\newif\ifzifour@altzero
\newif\ifzifour@noupq
\newif\ifzifour@mono
\newif\ifzifour@hyphen
% hyphenation is inhibited by default, but word spacing is, by default
% variable. The option mono  makes word spacing mono also.
\def\zifour@sp{.5em}
\def\zifour@stretch{.25em}
\def\zifour@shrink{.167em}
\def\zifour@extrasp{0em}
\def\zifour@spn{.45em}
\def\zifour@stretchn{.225em}
\def\zifour@shrinkn{.15em}
\def\zifour@extraspn{0em}

% by default, change \tt to mean zi4.
\newcommand*{\zifour@default}{%
  \renewcommand*{\ttdefault}{zi4}}%

\newcommand\zifour@scaled{s*[1]}
%\define@key{zifour}{scaled}[1.0]{\def\zifour@scaled{s*[#1]}}
\DeclareOptionX{scaled}[1.0]{\renewcommand{\zifour@scaled}{s*[#1]}}
\DeclareOptionX{scale}[1.0]{\renewcommand{\zifour@scaled}{s*[#1]}}
%\DeclareOption*{%
%  \begingroup
%  \edef\x{\endgroup
%    \noexpand\setkeys{zifour}{\CurrentOption}}%
%  \x}
\def\zifour@hyph{\hyphenchar\font=\m@ne}
\DeclareOptionX{hyphenate}{%
	\def\zifour@hyph{}}

\DeclareOptionX{mono}{%
	\zifour@monotrue}

% option [nott] to avoid changing tt.
\DeclareOptionX{nott}{%
  \def\zifour@hyph{}\zifour@monofalse%
  \def\zifour@extrasp{0em}%
  \renewcommand*{\zifour@default}{%
  \renewcommand*{\rmdefault}{zi4}}%
}
% option [noupquote] to prevent loading upquote.
\DeclareOptionX{noupquote}{%
  \zifour@noupqtrue}%
  
% option var0---use unslashed zero (slashed is default)
\DeclareOptionX{var0}{%
  \zifour@altzerotrue\advance\zifour@ocount \tw@ %
}
\DeclareOptionX{varl}{%
  \advance\zifour@ocount \@ne %
}
\DeclareOptionX{varqu}{%
  \advance\zifour@ocount 4\relax %
}
\DeclareOptionX{narrow}{%
  \gdef\zifour@narrow{n} %
}
\DeclareOptionX{spacing}[.5em]{%
 \gdef\zifour@spx{#1}}
\DeclareOptionX{stretch}[.25em]{%
 \gdef\zifour@stretchx{#1}}
\DeclareOptionX{shrink}[.167em]{%
 \gdef\zifour@shrinkx{#1}}
\DeclareOptionX{extrasp}[.167em]{%
 \gdef\zifour@extraspx{#1}}

\ProcessOptionsX
\zifour@default

\ifzifour@mono%
\def\zifour@stretch{0em}
\def\zifour@shrink{0em}
\def\zifour@extrasp{.5em}
\def\zifour@stretchn{0em}
\def\zifour@shrinkn{0em}
\def\zifour@extraspn{.45em}
\fi
\ifdefined\zifour@narrow%
  \let\zifour@sp\zifour@spn
  \let\zifour@stretch\zifour@stretchn
  \let\zifour@shrink\zifour@shrinkn
  \let\zifour@extrasp\zifour@extraspn
\fi
% Allow values specified in options to override mono
\ifdefined\zifour@spx\let\zifour@sp\zifour@spx\fi
\ifdefined\zifour@stretchx\let\zifour@stretch\zifour@stretchx\fi
\ifdefined\zifour@shrinkx\let\zifour@shrink\zifour@shrinkx\fi
\ifdefined\zifour@extraspx\let\zifour@extrasp\zifour@extraspx\fi

%\ifzifour@hyphen%
%  \edef\zifour@hyph{\hyphenchar\font=45 }
%\else%
%  \edef\zifour@hyph{\hyphenchar\font=\m@ne}
%\fi
%\show\zifour@hyph

\edef\zifour@spc{%
	\fontdimen2\font=\zifour@sp%
	\fontdimen3\font=\zifour@stretch%
	\fontdimen4\font=\zifour@shrink%
	\fontdimen7\font=\zifour@extrasp%
	\zifour@hyph%
} % used to change default text spacing via fd files
%\show\zifour@spc
\edef\zifour@opt{\the\zifour@ocount}
\ifzifour@altzero 
  \advance\zifour@ocount -\tw@
\else
  \advance\zifour@ocount \tw@
\fi
\edef\zifour@altopt{\the\zifour@ocount}
% define an \altzero macro which flips to slashed, unslashed
\def\altzero{{\fontfamily{zi4}%
 \fontshape{scit}%
 \selectfont 0}}

 
\def\zifour@T@ne@nc{T1}
\def\zifour@OT@ne@nc{OT1}
\def\zifour@LY@ne@nc{LY1}
\def\zifour@QX@nc{QX}
\def\zifour@TQS{%
\UndeclareTextCommand{\textquotesingle}{\encodingdefault}
\DeclareTextSymbol{\textquotesingle}{TS1}{39}}

\ifzifour@noupq% do nothing
  % Try to correct for wrong slots for QX
  \ifx\encodingdefault\zifour@QX@nc
    \zifour@TQS
  \else
    \ifx\encodingdefault\zifour@LY@ne@nc
      \zifour@TQS
    \fi
  \fi     
\else
  \AtBeginDocument{%
  \ifx\encodingdefault\zifour@T@ne@nc % do nothing
  \else
    \ifx\encodingdefault\zifour@OT@ne@nc % do nothing
    \else
      \zifour@TQS
    \fi
  \fi
  \usepackage{upquote}}
\fi

\endinput