summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/polski/ot1patch.dtx
blob: 33315b721ac8d304065d4340a726363c80ed567c (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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
% \iffalse -*- doctex -*-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                      %%
%%                        Package ot1patch                              %%
%%                                                                      %%
%% Purpose: to provide best possible substitutes for Polish national    %%
%%          characters using OT1 Computer Modern Roman fonts            %%
%%                                                                      %%
%%                                                                      %%
%% Copyright (c) by Marcin Woli\'nski                      <1997/06/18> %%
%%                  wolinski@gust.org.pl                                %%
%%                                                                      %%
%%                                                                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                      %%
%% The package may be used freely, but you are not allowed to modify    %%
%% this file.  If you wish to make any changes please make a copy       %%
%% under a different name.                                              %%
%%                                                                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \fi
  \def\fileversion{v 0.3}
  \def\docdate{1997/05/16}
  \def\filedate{1997/10/08}
% \CheckSum{209}
% 
% \title{Pakiet/Package ot1patch\thanks
%          {Version \fileversion\ dated \filedate.}}
% \author{Marcin Woli\'nski}
% \date{\docdate}
% 
% \maketitle
% Celem tego pakietu jest dostarczenie substytut\'{o}w polskich
% znak\'{o}w narodowych, zbudowanych jedynie ze znak\'{o}w
% dost\k{e}pnych w fontach w uk{\l}adzie OT1, szczeg\'{o}lnie fontach
% Computer Modern.  Poniewa\.{z} wysokiej jako\'{s}ci polskie fonty
% dla \TeX a s\k{a} publicznie dost\k{e}pne, stosowanie tego pakietu
% nie jest zalecane.  Mo\.{z}na go poleci\'c jedynie mieszka\'{n}com
% bezludnych wysp bez dost\k{e}pu do Internetu (ale sk\k{a}d oni mieli
% by mie\'c ten pakiet?).
%
% Pakiet zosta{\l} pomy\'{s}lany jako dodatek do pakietu \textsf{Po
% polsku} autorstwa Mariusza Olko.  Mo\.{z}na go jednak stosowa\'c
% niezale\.{z}nie.  Skutkiem zadeklarowania jego u\.{z}ycia
% komend\k{a} |\usepackage{ot1patch}| jest zmiana definicji
% niekt\'{o}rych komend akcentowych w uk{\l}adzie OT1
% (w~szczeg\'{o}lno\'{s}ci komenda |\k| produkuj\k{a}ca ogonek,
% przestaje powodowa\'c b{\l}\k{a}d).  Uk{\l}ad OT1 nie jest w istocie
% dobrze okre\'{s}lony, bowiem fonty ,,maszynowe'' r\'{o}\.{z}ni\k{a}
% si\k{e} od pozosta{\l}ych na kilku pozycjach.  \textsf{ot1patch}
% troszczy si\k{e} i o t\k{e} spraw\k{e}.
%
% Pakiet \textsf{ot1patch} w istocie jest adaptacj\k{a} do nowego
% \LaTeX a stylu \textsf{plfonts.sty} autorstwa Leszka Holenderskiego.
% Styl ten jest najstaranniejsz\k{a} znan\k{a} mi wersj\k{a}
% dorobienia protez ogonk\'{o}w do font\'{o}w Computer Modern.
%
% \bigskip
% The purpose of this package is to provide substitutes of Polish
% national characters built using only old fonts (OT1). Besides of
% producing characters missing from OT1 this package takes care of
% less obvious matter: OT1 is not a really well-defined encoding since
% typewritter fonts differ from others in some positions.
%
% The package is loaded in the standard way with the
% |\usepackage{ot1patch}| command.
% 
% \StopEventually{}
% 
% \section{Implementation}
% \iffalse 
% Since I hate the presence of section `Printing the documentation' in
% every DOCed package my driver is put into a metacomment.  To print
% documentation LaTeX this file. If you need to change the driver run
% DOCSTRIP and ask it to make ogonek.drv by stripping ogonek.dtx with
% option `driver'. Do *not* modify this file.
%<*driver>
\documentclass{ltxdoc}
\usepackage{ot1patch}
\DisableCrossrefs
%<driver>%\OnlyDescription
%<driver>%\EnableCrossrefs
%<driver>%\CodeLinesIndex
\begin{document} 
  \DocInput{ot1patch.dtx}
\end{document}
%</driver>
% \fi
%
% \subsection{Identification}
% We start the code with standard identification of the package
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{ot1patch}[\filedate\space\fileversion\space
                     A patch for some OT1 characters (MW)]
%    \end{macrocode}
% 
% \subsection{The \texttt{\string\k} macro (Polish ogonek)}
% This comes from L.~Holenderski's \texttt{plfonts.sty}.
% Positioning of ogonek for specific letters is tuned for 300dpi
% Computer Modern fonts, but works reasonably well with other
% resolutions.
% 
% Ogonek is made from half-circle used by \TeX\ to produce
% $\hookrightarrow$.
% \begin{macro}{\@sob}
% Macro |\@sob| positioning ogonek under a letter.   Parameters are
% letter and fractions hl,ho,vl,vo. 
%    \begin{macrocode}
\dimendef\pl@left=0 \dimendef\pl@down=1 
\dimendef\pl@right=2 \dimendef\pl@temp=3
\def\@sob#1#2#3#4#5{%
  \setbox0\hbox{#1}\setbox1\hbox{$_\mathchar'454$}\setbox2\hbox{p}%
  \pl@right=#2\wd0 \advance\pl@right by-#3\wd1
  \pl@down=#5\ht1 \advance\pl@down by-#4\ht0
  \pl@left=\pl@right \advance\pl@left by\wd1
  \pl@temp=-\pl@down \advance\pl@temp by\dp2 \dp1=\pl@temp
  \leavevmode
  \kern\pl@right\lower\pl@down\box1\kern-\pl@left #1}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\@iIuUogonek}
% \begin{macro}{\k}
% Here is the |\k| default macro (it is not normally defined in OT1), with
% special positioning of ogonek for some letters. We don't do this with
% |\DeclareTextCompositeCommand| because it wouldn't fit with the defaults
% mechanism.
%    \begin{macrocode}
\def\@iIuUogonek#1{%
        \ifx i#1\@sob i{.66}{.20}{0}{.90}\else
        \ifx I#1\@sob I{.80}{.50}{0}{.90}\else
        \ifx u#1\@sob u{.66}{.20}{0}{.90}\else
        \ifx U#1\@sob U{.60}{.35}{0}{.90}\else
        \@sob {#1}{.50}{.35}{0}{.90}\fi 
        \fi \fi \fi 
        }
\DeclareTextCommandDefault\k[1]{%
        \ifx a#1\@sob a{.66}{.20}{0}{.90}\else
        \ifx A#1\@sob A{.80}{.50}{0}{.90}\else
        \ifx e#1\@sob e{.50}{.35}{0}{.93}\else
        \ifx E#1\@sob E{.60}{.35}{0}{.90}\else
        \@iIuUogonek{#1}%
        \fi \fi \fi \fi 
   }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% 
% \subsection{Polish crossed l}
% Since in typewritter fonts there is no cross character for Polish \l\ we
% will have to take special actions then. For that purpose we define the
% next macro. It performs a rather devious check if the font in use is
% `typewritter like'. Regular text fonts contain in position '40 the cross
% for Polish \l, but in typewritter `visible space' occurs there. Second
% of these characters has positive depth, contrary to the first, so we
% check for that. This is slow, better check is welcome.
% 
%    \begin{macrocode}
\def\if@ttfont#1#2{\setbox0=\hbox{\char'40}\ifdim\dp0>0pt#1\else#2\fi}
%    \end{macrocode}
% 
% \begin{macro}{\@spb}
% This definition is used to cross l or L in typewritter fonts.
% \changes{0.2}{1997/06/07}{Added leavevmode}
%    \begin{macrocode}
\def\@spb#1#2#3#4#5{%
  \setbox0\hbox{#1}\setbox2\hbox{\char'023}%
  \pl@right=#2\wd0 \advance\pl@right by-#3\wd2
  \pl@down=#5\ht2 \advance\pl@down by-#4\ht0
  \pl@left=\pl@right \advance\pl@left by\wd2
  \ht2=\pl@down \dp2=-\pl@down
  \leavevmode
  \kern\pl@right\lower\pl@down\box2\kern-\pl@left #1}
%    \end{macrocode}
% \end{macro}
% 
%    And here are definitions of |\l| and |\L|. Unfortunately we have
%    to redefine \LaTeX's values.
%    \begin{macrocode}
\DeclareTextCommand\l{OT1}{%
  \if@ttfont{\@spb l{.45}{.5}{.4}{.8}}%
    {{\char32l}}}
\DeclareTextCommand\L{OT1}{%
  \if@ttfont{\@spb L{.23}{.5}{.4}{.8}}%
    {\leavevmode\setbox0\hbox{L}\hbox to\wd0{\hss\char32L}}}
%    \end{macrocode}
% 
% \subsection{Dot accent}
% \begin{macro}{\@skb}
%    \changes{0.2}{1997/06/07}{Added leavevmode} 
%    Typewritter fonts don't contain the dot accent so we use raised
%    period instead.  As this style is prepared with Polish language
%    in mind, this is done for \.z only.
%    \begin{macrocode}
\def\@skb#1#2#3#4#5{%
  \setbox0\hbox{#1}\setbox1\hbox{\char'056}%
  \pl@right=#2\wd0 \advance\pl@right by-#3\wd1
  \pl@down=#5\ht1 \advance\pl@down by-#4\ht0
  \pl@left=\pl@right \advance\pl@left by\wd1
  \leavevmode
  \kern\pl@right\lower\pl@down\box1\kern-\pl@left #1}
%    \end{macrocode}
%  \end{macro}
%
%    And appropriate redefinition for |\.|:
%    \begin{macrocode}
\DeclareTextCompositeCommand\.{OT1}z{%
  \if@ttfont{\@skb z{.5}{.5}{1.2}{0}}%
    {{\accent'137z}}}
\DeclareTextCompositeCommand\.{OT1}Z{%
  \if@ttfont{\@skb Z{.5}{.5}{1.1}{0}}%
    {{\accent'137Z}}}
%    \end{macrocode}
% 
% \subsection{French quotes
%             (\guillemotleft guillemotes\guillemotright)} 
% \changes{0.2}{1997/06/18}{Added \cs{leavevmode}}
%    Here is the best substitute for guillemotes we could think of. 
%    \begin{macrocode}
\DeclareTextCommandDefault\guillemotleft
    {\leavevmode\raise.3ex
        \hbox{$\scriptscriptstyle\langle\!\langle$}}
\DeclareTextCommandDefault\guillemotright
    {\leavevmode\raise.3ex
        \hbox{$\scriptscriptstyle\rangle\!\rangle$}}
%    \end{macrocode}
% 
% And that's all.
%    \begin{macrocode}
\endinput
%</package>
%    \end{macrocode}
% 
% 
% \Finale