summaryrefslogtreecommitdiff
path: root/fonts/librecaslon/latex/librecaslon.sty
diff options
context:
space:
mode:
Diffstat (limited to 'fonts/librecaslon/latex/librecaslon.sty')
-rw-r--r--fonts/librecaslon/latex/librecaslon.sty80
1 files changed, 65 insertions, 15 deletions
diff --git a/fonts/librecaslon/latex/librecaslon.sty b/fonts/librecaslon/latex/librecaslon.sty
index 63d68c7045..f899f51d28 100644
--- a/fonts/librecaslon/latex/librecaslon.sty
+++ b/fonts/librecaslon/latex/librecaslon.sty
@@ -1,14 +1,16 @@
\ProvidesPackage{librecaslon}[%
- 2020/07/24 (Bob Tennent) Supports LibreCaslon fonts for xeLaTeX and luaLaTeX. ]
+ 2020/07/28 (Bob Tennent) Supports LibreCaslon fonts for all LaTeX engines. ]
-\RequirePackage{iftex}
+\RequirePackage{ifxetex,ifluatex,textcomp}
-\ifpdftex
-\PackageError{librecaslon}{%
- *****************************************\MessageBreak
- Please process using XeLaTeX or luaLaTeX\MessageBreak
- *****************************************}
-\fi
+\newif\iflibrecaslon@otf
+\ifxetex
+ \librecaslon@otftrue
+\else\ifluatex
+ \librecaslon@otftrue
+\else % [pdf]LaTeX
+ \librecaslon@otffalse
+\fi\fi
\newif\iflibrecaslon@lining \librecaslon@liningtrue
@@ -17,6 +19,8 @@
\DeclareOptionX{scaled}{\renewcommand*{\LibreCaslon@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\LibreCaslon@scale}{#1}}
+\DeclareOptionX{type1}{\librecaslon@otffalse}
+
\DeclareOptionX{lining}[true]{%
\@nameuse{if#1}%
\librecaslon@liningtrue
@@ -49,14 +53,32 @@
\ProcessOptionsX\relax
+\iflibrecaslon@otf
\iflibrecaslon@lining
\def\librecaslon@figurestyle{Monospaced}
\else
\def\librecaslon@figurestyle{OldStyle}
\fi
-\RequirePackage{fontspec}
+\else % type1
+
+ \iflibrecaslon@lining
+ \def\librecaslon@figurealign{T}
+ \def\librecaslon@figurestyle{LF}
+ \else
+ \def\librecaslon@figurealign{}
+ \def\librecaslon@figurestyle{OsF}
+ \fi
+\fi
+
+\iflibrecaslon@otf
+ \RequirePackage{fontspec}
+\else
+ \RequirePackage{fontenc,fontaxes}
+\fi
+
+\iflibrecaslon@otf
\ifxetex\XeTeXtracingfonts=1\fi
\defaultfontfeatures{
Ligatures = TeX ,
@@ -68,7 +90,8 @@
UprightFont = *-Regular ,
ItalicFont = *-Italic ,
BoldFont = *-Bold ,
- ]
+ BoldItalicFont = LibreCsln-BoldItalic,
+ ]
{LibreCaslonText}
\providecommand\useosf{%
\edef\librecaslon@figurestyle{OldStyle}
@@ -82,7 +105,8 @@
UprightFont = *-Regular ,
ItalicFont = *-Italic ,
BoldFont = *-Bold ,
- ]
+ BoldItalicFont = LibreCsln-BoldItalic,
+ ]
{LibreCaslonText}
\defaultfontfeatures{}
}
@@ -91,39 +115,65 @@
UprightFont = *-Regular ,
ItalicFont = *-Italic ,
BoldFont = *-Bold ,
- ]
+ BoldItalicFont = LibreCsln-BoldItalic,
+ ]
{LibreCaslonText}
\newfontfamily\librecaslonOsF
[ Numbers = {OldStyle},
UprightFont = *-Regular ,
ItalicFont = *-Italic ,
BoldFont = *-Bold ,
- ]
+ BoldItalicFont = LibreCsln-BoldItalic,
+ ]
{LibreCaslonText}
\newfontfamily\librecaslonLF
[ Numbers = {},
UprightFont = *-Regular ,
ItalicFont = *-Italic ,
BoldFont = *-Bold ,
- ]
+ BoldItalicFont = LibreCsln-BoldItalic,
+ ]
{LibreCaslonText}
\newfontfamily\librecaslonTLF
[ Numbers = {Monospaced},
UprightFont = *-Regular ,
ItalicFont = *-Italic ,
BoldFont = *-Bold ,
- ]
+ BoldItalicFont = LibreCsln-BoldItalic,
+ ]
{LibreCaslonText}
\providecommand\sufigures{\librecaslonOsF\addfontfeatures{VerticalPosition=Superior}}
\providecommand\infigures{\librecaslonOsF\addfontfeatures{VerticalPosition=ScientificInferior}}
+\else % type1
+
+ \def\librecaslonfamily{LibreCsln-\librecaslon@figurealign\librecaslon@figurestyle}
+ \providecommand*\librecaslon{\fontfamily{\librecaslonfamily}\selectfont}
+ \providecommand*\librecaslonLF{\fontfamily{LibreCsln-LF}\selectfont}
+ \providecommand*\librecaslonTLF{\fontfamily{LibreCsln-TLF}\selectfont}
+ \providecommand*\librecaslonOsF{\fontfamily{LibreCsln-OsF}\selectfont}
+
+ \fa@naming@exception{figures}{{superior}{proportional}}{Sup}
+ \fa@naming@exception{figures}{{superior}{tabular}}{Sup}
+ \providecommand\sufigures{\@nomath\sufigures\fontfigurestyle{superior}\selectfont}
+ \fa@naming@exception{figures}{{inferior}{proportional}}{Inf}
+ \fa@naming@exception{figures}{{inferior}{tabular}}{Inf}
+ \def\infigures{\@nomath\infigures\fontfigurestyle{inferior}\selectfont}
+
+ \renewcommand*\rmdefault{\librecaslonfamily}
+ \providecommand*\useosf{\edef\librecaslon@figurealign{}\edef\librecaslon@figurestyle{OsF}%
+ \renewcommand*{\rmdefault}{LibreCsln-OsF}}
+
+\fi
\DeclareTextFontCommand{\textsu}{\sufigures}
\DeclareTextFontCommand{\textin}{\infigures}
% turn off defaults in case other fonts are selected:
+\iflibrecaslon@otf
\defaultfontfeatures{}
+\fi
\endinput