some epub/mobi fixes
[librarian.git] / librarian / pdf / wl.sty
index 1299aec..28a23a5 100644 (file)
@@ -1,10 +1,60 @@
-\usepackage[MeX]{polski}
+% -*- coding: utf-8 -*-
 
+\usepackage[MeX]{polski}
 
 \usepackage[xetex]{graphicx}
-\usepackage{xltxtra}
+\usepackage{fontspec}
 \usepackage{xunicode}
+\usepackage{xltxtra}
 
+\usepackage[overload]{textcase}
+\usepackage{scalefnt}
+\usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
+
+\setmainfont [
+%ExternalLocation,
+UprightFont = JunicodeWL-Regular,
+ItalicFont = JunicodeWL-Italic,
+BoldFont = JunicodeWL-Regular,
+BoldItalicFont = JunicodeWL-Italic,
+SmallCapsFont = JunicodeWL-Regular,
+SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
+Numbers=OldStyle,
+Scale=1.04,
+LetterSpace=-1.0
+] {JunicodeWL}
+
+\newfontfamily\alien[
+SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
+Numbers=OldStyle,
+Scale=0.85,
+LetterSpace=-1.0
+] {DejaVu Serif}
+
+
+\defaultfontfeatures{
+SizeFeatures={
+  {Size={-10}, FakeStretch=1.02, LetterSpace=2.0 },
+  {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
+  {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
+}
+}
+
+\renewcommand{\textsc}[1]{%
+{\addfontfeature{
+SizeFeatures={
+  {Size={-10}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
+  {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
+  {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
+},
+Letters={SmallCaps,UppercaseSmallCaps}
+}
+#1}
+}
+
+%{\itshape JunicodeWL-Italic.ttf }
+%{\bfseries Junicode-Bold.ttf }
+%{\bfseries\itshape Junicode-BoldItalic.ttf }
 
 \pagestyle{plain}
 \usepackage{fancyhdr}
 \pagestyle{fancy}
 \fancyhf{}
 \renewcommand{\headrulewidth}{0pt}
-\renewcommand{\footrulewidth}{0.4pt}
-\lfoot{{\footnotesize \@author, \emph{\@title}}}
+\renewcommand{\footrulewidth}{0pt}
+\lfoot{{\footnotesize \textsc{\@author} \emph{\@title}}}
 \cfoot{}
 \rfoot{{\footnotesize \thepage}}
 
 \clubpenalty=100000
 \widowpenalty=100000
 
+
+% see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
+\newsavebox{\ximagebox}\newlength{\ximageheight}
+\newsavebox{\xglyphbox}\newlength{\xglyphheight}
+\newcommand{\xbox}[1]
+{\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
+\savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
+\raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
+\makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
+\usebox{\ximagebox}%
+\raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
+
+\newcommand{\makecover}[2]{
+        \pdfpagewidth=#1
+        \pdfpageheight=#2
+
+        \thispagestyle{empty}
+        \newlength{\PictHOffset}
+        \newlength{\PictVOffset}
+        \setlength{\PictHOffset}{1in}
+        \addtolength{\PictHOffset}{\hoffset}
+        \addtolength{\PictHOffset}{\oddsidemargin}
+
+        \setlength{\PictVOffset}{1in}
+        \addtolength{\PictVOffset}{\voffset}
+        \addtolength{\PictVOffset}{\topmargin}
+        \addtolength{\PictVOffset}{\headheight}
+        \addtolength{\PictVOffset}{\headsep}
+        \addtolength{\PictVOffset}{\topskip}
+        \addtolength{\PictVOffset}{-\pdfpageheight}
+
+        \noindent\hspace*{-\PictHOffset}%
+        \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
+            \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.png}}}
+        \clearpage
+
+        \setlength{\pdfpagewidth}{210mm}
+        \setlength{\pdfpageheight}{297mm}
+}
+
+
 \renewcommand{\maketitle}{
     {
     \thispagestyle{empty}
     \color{theme}
 
     \noindent \begin{minipage}[t]{.35\textwidth}\vspace{0pt}
-        \includegraphics[width=\textwidth]{wl-logo.png}
+        \href{http://www.wolnelektury.pl}{\xbox{\includegraphics[width=\textwidth]{wl-logo.png}}}
     \end{minipage}
     \begin{minipage}[t]{.65\textwidth}\vspace{0pt}
-        \sourceinfo
 
+    \ifflaglessadvertising
+    \else
+        \href{\bookurl}{Ta lektura}, podobnie jak tysiące innych, jest dostępna on-line na stronie
+        \href{http://www.wolnelektury.pl/}{wolnelektury.pl}.
         \vspace{.5em}
+    \fi
 
-        Wejdź na stronę http://wolnelektury.pl/ i~zobacz, jak wiele możliwości daje interaktywna wersja szkolnej biblioteki
-        internetowej Wolne Lektury.
-        \vspace{.5em}
+    Utwór opracowany został w ramach projektu \href{http://www.wolnelektury.pl/}{Wolne Lektury}
+    przez \href{http://nowoczesnapolska.org.pl}{fundację Nowoczesna Polska}.
 
-        Ten utwór nie jest chroniony prawem autorskim i~znajduje się w~domenie publicznej, co oznacza, że możesz go swobodnie wykorzystywać, publikować i~rozpowszechniać.
+    \end{minipage}
+    \noindent \rule{\linewidth}{0.4pt}
 
-        \vspace{.6em}
+    \vspace{.6em}
+    \color{black}
+    }
+}
 
-    \end{minipage}
+\newcommand{\editorialsection}{
+  \begin{figure}[b!]
+  {
+    \footnotesize
+    \color{theme}
     \noindent \rule{\linewidth}{0.4pt}
 
+    \rightsinfo
+    \vspace{.6em}
+
+    Źródło: \href{\bookurl}{\bookurl}
+
     \vspace{.6em}
+    \sourceinfo
+
+    \description
+    \vspace{.6em}
+
+    \editors
+
     \color{black}
+  }
+  \end{figure}
+}
 
-%    \begin{figure}[b!]
-%        \footnotesize
-%        \color{theme}
-%        \noindent \rule{\linewidth}{0.4pt}
 
-%        Szkolna biblioteka internetowa Wolne Lektury tworzona jest dzięki pracy Wolontariuszy, ale to osoby
-%        zatrudnione w~FNP będą musiały wymyślić, co powinno zostać napisane w~tym miejscu. Można zupełnie usunąć
-%        tę sekcję, ale autor konwertera chciał się popisać, że umie coś takiego zrobić.
-%        \color{black}
-%    \end{figure}
-    }
+\newcommand{\typosubsubsection}[1]{%
+{\textsc{#1}}
+}
+
+\newcommand{\typosubsection}[1]{%
+{\addfontfeature{
+SizeFeatures={
+  {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
+  {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
+  {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
+},
+Letters={Uppercase}
+}
+\MakeUppercase{#1}}
 }
 
+\newcommand{\typosection}[1]{%
+{\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
+%{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
+}
 
 
+\newcommand{\tytul}[1]{%
+#1%
+\vspace{1em}%
+}
 
 \newcommand{\nazwapodutworu}[1]{%
-\section*{#1}%
+\section*{\typosection{#1}}%
 }
 
 \newcommand{\autorutworu}[1]{%
-\subsection*{#1}%
+\subsection*{\typosubsection{#1}}%
+}
+
+\newcommand{\dzielonadrzedne}[1]{%
+\subsection*{\typosubsubsection{#1}}%
 }
 
 \newcommand{\nazwautworu}[1]{%
-\section*{#1}%
+\section*{\typosection{#1}}%
 }
 
+\newcommand{\podtytul}[1]{%
+\subsection*{\typosubsubsection{#1}}%
+}
+
+\newcommand{\translator}[1]{%
+\subsection*{\typosubsubsection{tłum. #1}}%
+}
+
+
 \newcommand{\powiesc}[1]{#1}
 \newcommand{\opowiadanie}[1]{#1}
 \newcommand{\lirykal}[1]{#1}
 }
 
 \newcommand{\nagloweklisty}[1]{%
-\textbf{#1}%
+\typosubsubsection{#1}%
 }
 
 \newcommand{\listaosoba}[1]{%
 }
 
 \newcommand{\naglowekakt}[1]{%
-\subsection*{#1}%
+\pagebreak
+\subsection*{\typosubsection{#1}}%
 }
 \newcommand{\naglowekczesc}[1]{%
-\subsection*{#1}%
+\pagebreak
+\subsection*{\typosubsection{#1}}%
 }
 \newcommand{\srodtytul}[1]{%
-\subsection*{#1}%
+\subsection*{\typosubsection{#1}}%
 }
 
 \newcommand{\naglowekscena}[1]{%
-\subsubsection*{#1}%
+\subsubsection*{\typosubsubsection{#1}}%
 }
-\newcommand{\naglowekrozdzia}[1]{%
-\subsubsection*{#1}%
+\newcommand{\naglowekrozdzial}[1]{%
+\subsubsection*{\typosubsubsection{#1}}%
 }
 
 \newcommand{\naglowekosoba}[1]{%
-\par{#1}\nopagebreak%
+\par{\textsc{#1}}\nopagebreak%
 }
 \newcommand{\naglowekpodrozdzial}[1]{%
 \par{#1}\nopagebreak%
 }
 
 
-\newcommand{\pa}[1]{\footnote{#1}}
-\newcommand{\pe}[1]{\footnote{#1}}
-\newcommand{\pr}[1]{\footnote{#1}}
-\newcommand{\pt}[1]{\footnote{#1}}
+\newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
+\newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
+\newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
+\newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
 
 \newcommand{\mat}[1]{$#1$}
 
 }
 
 \newcommand{\osoba}[1]{%
-\textsc{#1}%
+#1%
 }
 
 \newcommand{\sekcjaswiatlo}{%
-\hspace{30pt}%
+\vspace{30pt}%
 }
 
 \newcommand{\sekcjaasterysk}{%
+\vspace{10pt}%
+\begin{center}%
 \par{*}%
+\end{center}%
 }
 
 \newcommand{\separatorlinia}{%
+\vspace{10pt}%
 \hrule{}%
+\vspace{10pt}%
 }
 
 \newcommand{\motyw}[2][0]{%