Debian Codegraph @

texmf-dist/source/xelatex/philokalia/philokalia.dtx

raw
1 %% \CharacterTable
2 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
3 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
4 %% Digits \0\1\2\3\4\5\6\7\8\9
5 %% Exclamation \! Double quote \" Hash (number) \#
6 %% Dollar \$ Percent \% Ampersand \&
7 %% Acute accent \' Left paren \( Right paren \)
8 %% Asterisk \* Plus \+ Comma \,
9 %% Minus \- Point \. Solidus \/
10 %% Colon \: Semicolon \; Less than \<
11 %% Equals \= Greater than \> Question mark \?
12 %% Commercial at \@ Left bracket \[ Backslash \\
13 %% Right bracket \] Circumflex \^ Underscore \_
14 %% Grave accent \` Left brace \{ Vertical bar \|
15 %% Right brace \} Tilde \~}
16 %\iffalse
17 %
18 % (c) Copyright 2007-2017 Apostolos Syropoulos
19 % This program can be redistributed and/or modified under the
20 % terms of the LaTeX Project Public License Distributed from
21 % http://www.latex-project.org/lppl.txt; either
22 % version 1.3c of the License, or any later version.
23 %
24 % This work has the LPPL maintenance status `maintained'.
25 %
26 % Please report errors or suggestions for improvement to
27 %
28 % Apostolos Syropoulos ([email protected])
29 %
30 %\fi
31 % \CheckSum{124}
32 % \iffalse This is a Metacomment
33 %
34 %<philokalia>\ProvidesFile{philokalia.sty}
35 %<TUplk>\ProvidesFile{eu1plk.fd}
36 %
37 %<philokalia>[2017/09/20 v1.2 Package `philokalia']
38 %<TUplk>[2017/09/20 v1.0 Philokalia-Regular Support File]
39 %
40 % \begin{macrocode}
41 %<*driver>
42 \documentclass{ltxdoc}
43 \makeatletter
44 \let\ancientgreek\l@ancientgreek
45 \makeatother
46 \usepackage{philokalia}
47 \usepackage{fullpage}
48 \GetFileInfo{philokalia.drv}
49 \begin{document}
50 \DocInput{philokalia.dtx}
51 \end{document}
52 %</driver>
53 % \end{macrocode}
54 % \fi
55 %
56 %\title{The \textsf{philokalia} package}
57 %\author{Apostolos Syropoulos\\366, 28th October Str.\\
58 %GR-671 33 Xanthi, HELLAS\\
59 %Email:\texttt{[email protected]}}
60 % \date{2007/01/25 updated on 2017/09/20}
61 %\maketitle
62 %\begin{abstract}
63 % This document describes the functionality of the \textsf{philokalia} package, which
64 % has been designed to ease the use of the Philokalia-Regular OpenType font with \XeLaTeX, as well as
65 % the OpenType features of this font.
66 %\end{abstract}
67 %\StopEventually{}
68 %\section{Introduction}
69 % The \textsf{philokalia} package has been designed to ease the use of the Philokalia-Regular (henceforward
70 % it will specified simply as the font)
71 % OpenType font with \XeLaTeX. The package provides two options: \texttt{global} and \texttt{local}.
72 % When the package is used with the \texttt{global} option the font is made the main font of the entire
73 % document. Also, this option provides support to typeset titling capitals.
74 % When the package is used with the \texttt{local} option, which is the default option,
75 % it provides the commands \verb=\textphlk= and \verb=\phkl= to enable typesetting of short passages.
76 % The first command takes one argument which is typeset using the font. The second command makes the font
77 % the main font of the current (local) scope. The complete package provides the
78 % following \XeLaTeX\ files:
79 %\begin{center}
80 % \begin{tabular}{ll}
81 % driver & produce the documentation \\
82 % philokalia & the package itself \\
83 % TUpkl & The Philokalia font shapes\\
84 % \end{tabular}
85 % \end{center}
86 %
87 % \section{About The Font}
88 %
89 % The font started as a project to digitize the typeface that was
90 % used to typeset the Philokalia books. For information regarding these books, the reader
91 % should visit either the following URL:
92 %\begin{center}
93 % \verb=http://orthodoxwiki.org/Philokalia=
94 %\end{center}
95 % or enter the word {\em philokalia} in the Amazon.com search box, for information about various
96 % editions of the books. The project was carried out by
97 % Apostolos Syropoulos and Ioannis Gamvets. Initially, the project was part
98 % of Ioannis Gamvetas's diploma thesis, but the resulting OpenType font is not part of this
99 % thesis work and it was developed by this author. The goal of the original thesis work was to develop Type~1
100 % fonts and tools to typeset portions of the Philokalia books with Omega. Since, the original thesis work
101 % has not been completed yet (!), the idea of releasing an OpenType font emerged quite naturally.
102 % The font contains only Greek letters and it can be used to typeset any Greek text. However, since the
103 % shapes of the letters are not that obvious, here is a ``translation''-table:
104 % \begin{center}
105 % \begin{tabular}{cccccccccc}
106 % \textphlk{α} & \texttt{α} & \textphlk{β} & \texttt{β} & \textphlk{γ} & \texttt{γ} &
107 % \textphlk{δ} & \texttt{δ} & \textphlk{ε} & \texttt{ε} \\
108 % \textphlk{ζ} & \texttt{ζ} & \textphlk{η} & \texttt{η} & \textphlk{θ} & \texttt{θ} &
109 % \textphlk{ι} & \texttt{ι} & \textphlk{κ} & \texttt{κ} \\
110 % \textphlk{λ} & \texttt{λ} & \textphlk{μ} & \texttt{μ} & \textphlk{ν} & \texttt{ν} &
111 % \textphlk{ξ} & \texttt{ξ} & \textphlk{ο} & \texttt{ο} \\
112 % \textphlk{π} & \texttt{π} & \textphlk{ρ} & \texttt{ρ} & \textphlk{σ} & \texttt{σ} &
113 % \textphlk{ς} & \texttt{ς} & \textphlk{τ} & \texttt{τ} \\
114 % \textphlk{υ} & \texttt{υ} & \textphlk{φ} & \texttt{φ} & \textphlk{χ} & \texttt{χ} &
115 % \textphlk{ψ} & \texttt{ψ} & \textphlk{ω} & \texttt{ω}
116 % \end{tabular}
117 % \end{center}
118 % One interesting feature of this font is that accents are placed {\em after} capital
119 % letters (see the sample below). Another interesting feature of the font is the great number of
120 % ligatures it includes. In fact, it includes more than 40 {\em historical} ligatures plus two
121 % {\em contextual} ligatures. When typing \texttt{κι} and these letters are not part of a word, then
122 % one gets the contextual ligature \textphlk{κι}, which is the Greek ampersand. The same ligature can be
123 % obtained if we substitute {\em iota} with {\em iota with varia}. The table below shows all the historical
124 % ligatures included in the font:
125 % \begin{center}
126 % \begin{tabular}{llllllllll}
127 % \textphlk{λλ} & \texttt{λλ} & \textphlk{ἀν} & \texttt{ἀν} & \textphlk{εν} & \texttt{εν} &
128 % \textphlk{γάρ} & \texttt{γάρ} & \textphlk{κατὰ} & \texttt{κατὰ} \\
129 % \textphlk{μετὰ} & \texttt{μετὰ} & \textphlk{στί} & \texttt{στί} & \textphlk{σθ} & \texttt{σθ} &
130 % \textphlk{σχ} & \texttt{σχ} & \textphlk{τῶν} & \texttt{τῶν} \\
131 % \textphlk{χρ} & \texttt{χρ} & \textphlk{καὶ} & \texttt{καὶ} & \textphlk{σσ} & \texttt{σσ} &
132 % \textphlk{δια} & \texttt{δια} & \textphlk{ευ} & \texttt{ευ} \\
133 % \textphlk{εὑ} & \texttt{εὑ} & \textphlk{εὐ} & \texttt{εὐ} & \textphlk{ου} & \texttt{ου} &
134 % \textphlk{ού} & \texttt{ού} & \textphlk{οὺ} & \texttt{οὺ} \\
135 % \textphlk{οὖ} & \texttt{οὖ} & \textphlk{οὗ} & \texttt{οὗ} & \textphlk{εύ} & \texttt{εύ} &
136 % \textphlk{αι} & \texttt{αι} & \textphlk{αῖ} & \texttt{αῖ} \\
137 % \textphlk{αί} & \texttt{αί} & \textphlk{αὶ} & \texttt{αὶ} & \textphlk{αἰ} & \texttt{αἰ} &
138 % \textphlk{αύ} & \texttt{αύ} & \textphlk{ει} & \texttt{ει} \\
139 % \textphlk{εῖ} & \texttt{εῖ} & \textphlk{όξ} & \texttt{όξ} & \textphlk{ὄξ} & \texttt{ὄξ} &
140 % \textphlk{ρί} & \texttt{ρί} & \textphlk{ρὶ} & \texttt{ρὶ} \\
141 % \textphlk{ρῖ} & \texttt{ρῖ} & \textphlk{ἡν} & \texttt{ἡν} & \textphlk{ην} & \texttt{ην} &
142 % \textphlk{ῆν} & \texttt{ῆν} & \textphlk{ήν} & \texttt{ήν} \\
143 % \textphlk{υν} & \texttt{υν} & \textphlk{ύν} & \texttt{ύν} & \textphlk{στ} & \texttt{στ} &
144 % \textphlk{΄-} & \texttt{΄-} & \textphlk{1Μο} & \texttt{1Μο} \\
145 % \textphlk{1μο} & \texttt{1μο} & \textphlk{΄1} & \texttt{΄1}
146 %
147 % \end{tabular}
148 % \end{center}
149 % Notice that in order to get the symbols \textphlk{΄-} and \textphlk{΄1}
150 % one has to type a tonos and then a
151 % hyphen or the digit one, respectively. The symbols \textphlk{΄-} and \textphlk{΄1}
152 % have been used by the ancient Greek mathematician Diophantus to denote the subtraction
153 % operator\footnote{Diophantus did not explicitly specified negative numbers in his writings, although
154 % he was aware of them.} and
155 % an unknown quantity (similar to the $x$ we use today in simple equations like $x+x^2=3$). Also, the
156 % symbols \textphlk{1Μο} and \textphlk{1μο} have been used by Diophantus to denote the unit (i.e., the
157 % number one). These symbol were not in the original Philokalia font, but they have been
158 % included here for reasons of completeness. The followin commands are provided for people who only
159 % want to typeset these symbols: \verb=\dsubop=, \verb=\dUnit=, \verb=\dunit=, and \verb=\dunknown=.
160 %
161 % The font includes titling capitals that are accessible through the titling OpenType feature,
162 % which, however, is implicitly available. In particular, the command \verb|\textinit|, which has two
163 % arguments, the first being the first letter of a word and the second being the rest of the word,
164 % can be used to typeset a drop capital. The following short passage from Aristotle's treatise
165 % {\em The Poetics} was typeset with the font so as to demonstrate the various features of it.
166 %
167 %{\fontfamily{plk}\selectfont\language\ancientgreek
168 % \font\PHtitl="[Philokalia-Regular]/ICU:script=grek,+titl"
169 % \newsavebox{\mybox}\savebox{\mybox}{\PHtitl Π}
170 % \lettrine[lines=3]{\usebox{\mybox}}{ερὶ} ποιητικῆς αὐτῆς τε καὶ τῶν εἰδῶν αὐτῆς, ἥν τινα δύναμιν ἕκαστον ἔχει,
171 %καὶ πῶς δεῖ συνίστασθαι τοὺς μύθους εἰ μέλλει καλῶς ἕξειν ἡ ποίησις, ἔτι δὲ ἐκ πόσων καὶ ποίων
172 %ἐστὶ μορίων, ὁμοίως δὲ καὶ περὶ τῶν ἄλλων ὅσα τῆς αὐτῆς ἐστι μεθόδου, λέγωμεν ἀρξάμενοι κατὰ φύσιν
173 %πρῶτον ἀπὸ τῶν πρώτων.
174 %
175 %Ἐποποιία δὴ καὶ ἡ τῆς τραγῳδίας ποίησις ἔτι δὲ κωμῳδία καὶ ἡ διθυραμβοποιητικὴ καὶ τῆς αὐλητικῆς
176 %ἡ πλείστη καὶ κιθαριστικῆς πᾶσαι τυγχάνουσιν οὖσαι μιμήσεις τὸ σύνολον· διαφέρουσι δὲ ἀλλήλων τρισίν,
177 %ἢ γὰρ τῷ ἐν ἑτέροις μιμεῖσθαι ἢ τῷ ἕτερα ἢ τῷ ἑτέρως καὶ μὴ τὸν αὐτὸν τρόπον.
178 %
179 %Ὥσπερ γὰρ καὶ χρώμασι καὶ σχήμασι πολλὰ μιμοῦνταί τινες ἀπεικάζοντες (οἱ μὲν [20] διὰ τέχνης οἱ δὲ διὰ συνηθείας),
180 %ἕτεροι δὲ διὰ τῆς φωνῆς, οὕτω κἀν ταῖς εἰρημέναις τέχναις ἅπασαι μὲν ποιοῦνται τὴν μίμησιν ἐν ῥυθμῷ καὶ λόγῳ καὶ
181 %ἁρμονίᾳ, τούτοις δ᾽ ἢ χωρὶς ἢ μεμιγμένοις· οἷον ἁρμονίᾳ μὲν καὶ ῥυθμῷ χρώμεναι μόνον ἥ τε αὐλητικὴ καὶ ἡ κιθαριστικὴ
182 %κἂν εἴ τινες [25] ἕτεραι τυγχάνωσιν οὖσαι τοιαῦται τὴν δύναμιν, οἷον ἡ τῶν συρίγγων, αὐτῷ δὲ τῷ ῥυθμῷ [μιμοῦνται]
183 %χωρὶς ἁρμονίας ἡ τῶν ὀρχηστῶν (καὶ γὰρ οὗτοι διὰ τῶν σχηματιζομένων ῥυθμῶν μιμοῦνται καὶ ἤθη καὶ πάθη καὶ πράξεις)·
184 % }
185 %
186 % \bigskip
187 % The first line of the code that was used to typeset the previous passage follows:
188 % \begin{center}
189 % \texttt{\char`\\setlanguage\char`\{ancientgreek\char`\}\char`\\textinit\char`\{Π\char`\}\char`\{ερὶ\char`\} ποιητικῆς
190 % αὐτῆς\ldots}
191 % \end{center}
192 % Notice that here we enable the \texttt{ancientgreek} hyphenation patterns to allows \XeTeX\ to correctly
193 % hyphenate the text.
194 %
195 % \section{The package \textsf{philokalia}}
196 %
197 % First of all, we have to load a number of packages that are necessary for the correct use of the font.
198 % In addition, we use the \textsf{lettrine} package to typeset the titling capitals.
199 % \begin{macrocode}
200 %<*philokalia>
201 \RequirePackage{xltxtra}
202 \RequirePackage{lettrine}
203 \newsavebox{\Pb@x}
204 % \end{macrocode}
205 % Unfortunately, we cannot use the \textsf{lettrine} package as it stands. We need to sligthly modify
206 % two macros. In particular, the macro \verb=\Lettrine@height=, which computes the height of the
207 % titling capital, has to compute the height of the letter \texttt{x} of a font in order to
208 % carry out its computation. Since the font does not include this character, we had to modify the
209 % code so as to compνute the height of the letter \texttt{α} instead. Similarly, we had to modify the macro
210 % \verb=\LettrineFont= because it was designed with the assumption that the main font of the document has
211 % the \texttt{X} character, which, again, is not valid for our case.
212 % \begin{macrocode}
213 \def\Lettrine@height{%
214 \@tempdima=\baselineskip
215 \setlength{\L@height}{\theL@lines\@tempdima}%
216 \ifnum\theL@lines>1
217 \addtolength{\L@height}{-\@tempdima}%
218 \fi
219 \sbox{\L@tbox}{\LettrineTextFont "03B1}%%%% Modified here
220 \addtolength{\L@height}{\ht\L@tbox}%
221 \addtolength{\L@height}{\L@oversize\L@height}}
222 \renewcommand*{\LettrineFont}{%
223 \Lettrine@height
224 \sbox{\L@tbox}{\LettrineFontHook\fontsize{\L@height}{\L@height}%
225 \selectfont "0391}%%%% Modified here
226 \@tempcntb=\ht\L@tbox
227 \@tempcnta=\L@height
228 \multiply\@tempcnta by 100
229 \divide\@tempcntb by 100
230 \divide\@tempcnta by \@tempcntb
231 \advance\@tempcnta by -9999
232 \ifnum\@tempcnta>0
233 \def\@tempa{1.\the\@tempcnta}%
234 \else
235 \def\@tempa{1}%
236 \fi
237 \LettrineFontHook
238 \fontsize{\@tempa\L@height}{\@tempa\L@height}%
239 \selectfont
240 }
241 % \end{macrocode}
242 % Now, we have to define the two options: global and local (the default one). In the first case, we
243 % define the command \verb|\textinit| that is used to typeset drop capitals from the titling
244 % capitals included in the font. By default, the \texttt{titl} feature of the font is not enabled
245 % as this would mean that all paragraphs would start with these really huge titling capitals.
246 % Also, the font is made the default font for the entire document. Notice that we use a box variable
247 % to store the letter that will appear as a drop capital. This is necessary in order to have in
248 % the box the titling capital and not the ordinary capital letter, or else the \verb|\lettrine|
249 % command will fail to correctly compute the height and width of the letter.
250 % \begin{macrocode}
251 \DeclareOption{global}{%
252 \renewcommand{\rmdefault}{plk}%
253 \DeclareFontFamily{TU}{plktitl}{}%
254 \DeclareFontShape{TU}{plktitl}{m}{n}%
255 {<-> "[Philokalia-Regular]/ICU:script=grek,+titl"}{}%
256 \newcommand{\textinit}[2]{%
257 \savebox{\Pb@x}{\usefont{TU}{plktitl}{m}{n} #1}%
258 \lettrine[lines=3]{\usebox{\Pb@x}}{#2}}%
259 }
260 % \end{macrocode}
261 % When the package is used with the default option, it provides two commands to typeset short
262 % passages of text. As is evident from the code that follows, the first macro is actually a
263 % definition and the second a command that can be used to typeset its argument with the font. Users
264 % should use the definition with care.
265 % \begin{macrocode}
266 \DeclareOption{local}{%
267 \def\phkl{\fontfamily{plk}\selectfont}%
268 \newcommand{\textphlk}[1]{{\phkl #1}}%
269 }
270 \ExecuteOptions{local}
271 \ProcessOptions
272 % \end{macrocode}
273 % The following commands are glyph access commands for the archaic mathematical symbols included in
274 % the font. They produce the symbols \dsubop, \dUnit, \dunit, and \dunknown, respectively.
275 % \begin{macrocode}
276 \def\dsubop{{\fontfamily{plk}\selectfont\char"018B}}
277 \def\dUnit{{\fontfamily{plk}\selectfont\char"018C}}
278 \def\dunit{{\fontfamily{plk}\selectfont\char"018D}}
279 \def\dunknown{{\fontfamily{plk}\selectfont\char"018E}}
280 %</philokalia>
281 % \end{macrocode}
282 %
283 % \section{The Font Definition File}
284 % Since there is only one font shape, there is not much work to do: we just need to specify
285 % the available font properties. We use the standard font encoding defined by package
286 % \textsf{fontspec}. In this version we use \texttt{TU} font encoding instead of \texttt{EU1}, which was
287 % predefined by the same package.
288 % \begin{macrocode}
289 %<*TUplk>
290 \DeclareFontFamily{TU}{plk}{}
291 \DeclareFontShape{TU}{plk}{m}{n}%
292 {<-> "[Philokalia-Regular]/ICU:script=grek,+hlig,+clig:mapping=tex-text"}{
293 }
294 % \end{macrocode}
295 % And then we define the various substitutions:
296 % \begin{macrocode}
297 \DeclareFontShape{TU}{plk}{m}{sl}{<-> ssub * plk/m/n}{}
298 \DeclareFontShape{TU}{plk}{m}{it}{<-> ssub * plk/m/sl}{}
299 \DeclareFontShape{TU}{plk}{m}{sc}{<-> ssub * plk/m/n}{}
300 \DeclareFontShape{TU}{plk}{b}{n}{<-> ssub * plk/m/n}{}
301 \DeclareFontShape{TU}{plk}{b}{sl}{<-> ssub * plk/m/n}{}
302 \DeclareFontShape{TU}{plk}{b}{it}{<-> ssub * plk/m/n}{}
303 \DeclareFontShape{TU}{plk}{bx}{n}{<-> ssub * plk/b/n}{}
304 \DeclareFontShape{TU}{plk}{bx}{it}{<-> ssub * plk/b/sl}{}
305 \DeclareFontShape{TU}{plk}{bx}{sl}{<-> ssub * plk/b/sl}{}
306 %</TUplk>
307 % \end{macrocode}
308 %
309 % \section*{Acknowledgements}
310 % First of all, I thank Ioannis Gamvetas for his collaboration back in the years 2002-2003.
311 % Also, I would like to thank George Williams, the designer of FontForge, the free font-editor, for all his
312 % valuable help, Adam Twardoch for explaining to me how to implement the contextual ligature, and Dimitrios
313 % Philippou for his comments and suggestions. Also, I thank Ioannis Vamvakas for letting me know that the
314 % previous version does not work with the latest version of package \textsf{fontspec}.
315 % Last, but certainly not least, I thank my son for his help!
316 %
317 % \Finale