summaryrefslogtreecommitdiff
path: root/fonts/poetica/inputs/poetica.sty
diff options
context:
space:
mode:
Diffstat (limited to 'fonts/poetica/inputs/poetica.sty')
-rw-r--r--fonts/poetica/inputs/poetica.sty59
1 files changed, 59 insertions, 0 deletions
diff --git a/fonts/poetica/inputs/poetica.sty b/fonts/poetica/inputs/poetica.sty
new file mode 100644
index 0000000000..078d7de9a4
--- /dev/null
+++ b/fonts/poetica/inputs/poetica.sty
@@ -0,0 +1,59 @@
+%%% Package File poetica.sty
+\newcount\poetic \newcount\poetbound \poetbound=4
+\newcount\poetceiling \poetceiling=8
+\newcount\poetfloor \poetfloor=0
+
+\def\wordbounds{\def\fancyshape{F}}
+\def\nowordbounds{\def\fancyshape{f}}\nowordbounds % default
+
+\def\parsefontshape#1#2{\poetic=-1% for `non-text' fonts
+ \if f#1\poetic=\poetbound \advance\poetic by#2 \fi
+ \if n#1\poetic=\poetfloor \advance\poetic by#2 \fi
+}
+\def\setshape{% input is the value of \poetic
+ \ifnum\poetic<0 \else
+ \ifnum\poetic<\poetbound \edef\fshape{n\the\poetic}%
+ \else\advance\poetic by-\poetbound \edef\fshape{\fancyshape\the\poetic}%
+ \fi
+ \fi
+}
+\newcommand{\Fontshape}[1]{\parsefontshape#1%
+ \fontshape{#1}\selectfont}
+\newenvironment{Poetica}{%
+ \begingroup\fontencoding{OT1}\fontfamily{poet}\fontsize{18}{22}
+ \fontseries{m}\Fontshape{n3}\poetic=3 \setshape}{\endgroup}
+\let\dhyph=\- \let\mytabs=\+ % save discretionary hyphen, tab command
+\let\oldhat=^ \let\oldsub=_ \let\oldvert=|
+\catcode`\^\active \catcode`\_\active
+\catcode`\|\active \def\|{\oldvert} \let|=\noboundary
+\newcount\INC \INC 1 % an increment register
+\def^{\bgroup \let\compare=-\let\bump=\bumpdown \INC-1 \poetic=\poetceiling
+ \afterassignment\getnextchar \global\let\nexttok= }
+\def_{\bgroup \let\compare=+\let\bump=\bumpup \INC 1 \poetic=\poetfloor
+ \afterassignment\getnextchar \global\let\nexttok= }
+\def\-{\bgroup \let\compare=-\let\bump=\bumpdown \INC-1 \bump
+ \afterassignment\getnextchar \global\let\nexttok= }
+\def\+{\bgroup \let\compare=+\let\bump=\bumpup \INC 1 \bump
+ \afterassignment\getnextchar \global\let\nexttok= }
+
+\def\getnextchar{%
+ \if\compare\nexttok % fancy sign? if so, bump the right way
+ \bump \let\nextact\grabchar
+ \else
+ \edef\nextact{\noexpand\typeset\noexpand\nexttok}% default behavior
+ \fi \nextact
+}
+\def\grabchar{\afterassignment\getnextchar \let\nexttok}
+\def\bumpdown{\advance\poetic \INC
+ \ifnum\poetic<\poetfloor \poetic\poetfloor \fi}
+\def\bumpup{\advance\poetic \INC
+ \ifnum\poetic>\poetceiling \poetic\poetceiling \fi}
+\def\typeset#1{\setshape\fontshape{\fshape}\selectfont
+ #1\egroup}
+
+%% ornaments and ampersands
+
+\newcommand{\orn}[1]{{\fontshape{orn}\selectfont\symbol{#1}}}
+\newcommand{\amp}[1]{{\fontshape{amp}\selectfont\symbol{#1}}}
+
+\endinput