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

\def\fileversion{1.10}
\def\filedate{2016/02/22}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{zi4}[\filedate\space v\fileversion]
\message{`inconsolata-zi4' v\fileversion, \filedate\space Text macros for Inconsolata (msharpe)}

\RequirePackage{textcomp}
\RequirePackage{keyval}

\newcount\zifour@ocount
\newif\ifzifour@altzero
\newif\ifzifour@noupq
\define@key{zifour}{scaled}[1.0]{\def\zifour@scaled{s*[#1]}}

\DeclareOption*{%
  \begingroup
  \edef\x{\endgroup
    \noexpand\setkeys{zifour}{\CurrentOption}}%
  \x}

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

% option [nott] to avoid changing tt.
\DeclareOption{nott}{%
  \renewcommand*{\zifour@default}{}%
}
% option [noupquote] to prevent loading upquote.
\DeclareOption{noupquote}{%
  \zifour@noupqtrue}%
  
% option var0---use unslashed zero (slashed is default)
\DeclareOption{var0}{%
  \zifour@altzerotrue\advance\zifour@ocount \tw@ %
}
\DeclareOption{varl}{%
  \advance\zifour@ocount \@ne %
}
\DeclareOption{varqu}{%
  \advance\zifour@ocount 4\relax %
}

\ProcessOptions*
\zifour@default
\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