summaryrefslogtreecommitdiff
path: root/fonts/kpfonts-otf/tex/kpfonts-otf.sty
diff options
context:
space:
mode:
Diffstat (limited to 'fonts/kpfonts-otf/tex/kpfonts-otf.sty')
-rw-r--r--fonts/kpfonts-otf/tex/kpfonts-otf.sty215
1 files changed, 106 insertions, 109 deletions
diff --git a/fonts/kpfonts-otf/tex/kpfonts-otf.sty b/fonts/kpfonts-otf/tex/kpfonts-otf.sty
index b182d5f199..9c9c4221f4 100644
--- a/fonts/kpfonts-otf/tex/kpfonts-otf.sty
+++ b/fonts/kpfonts-otf/tex/kpfonts-otf.sty
@@ -1,6 +1,6 @@
\NeedsTeXFormat{LaTeX2e}[2019-01-01]
-\def\fileversion{0.36}
-\def\filedate{2021-05-21}
+\def\fileversion{0.37}
+\def\filedate{2021-08-18}
\ProvidesPackage{kpfonts-otf}[\filedate\space\fileversion]
% Ensure luatex or xetex engine
@@ -36,57 +36,57 @@
\newif\ifkp@tight
%
% Global options
-\DeclareOption{light} {\kp@lighttexttrue\kp@lightmathtrue}
-\DeclareOption{nomath} {\kp@mathfalse\kp@symbolsfalse}
-\DeclareOption{notext} {\kp@textfalse}
-\DeclareOption{nosf} {\kp@sffalse}
-\DeclareOption{nott} {\kp@ttfalse}
-\DeclareOption{onlyrm} {\kp@ttfalse\kp@sffalse}
+\DeclareOption{light} {\kp@lighttexttrue\kp@lightmathtrue}
+\DeclareOption{nomath} {\kp@mathfalse\kp@symbolsfalse}
+\DeclareOption{notext} {\kp@textfalse}
+\DeclareOption{nosf} {\kp@sffalse}
+\DeclareOption{nott} {\kp@ttfalse}
+\DeclareOption{onlyrm} {\kp@ttfalse\kp@sffalse}
+\DeclareOption{fulloldstylenums} {\kp@osntrue\kp@osnmtrue}
+\DeclareOption{fulloldstyle} {\kp@ostrue\kp@Qtailtrue\kp@osntrue
+ \kp@osnmtrue}
% Text options
-\DeclareOption{lighttext} {\kp@lighttexttrue}
-\DeclareOption{oldstylenums} {\kp@osntrue}
-\DeclareOption{oldstyle} {\kp@ostrue\kp@osntrue\kp@Qtailtrue}
-\DeclareOption{veryoldstyle} {\kp@vostrue\kp@osntrue\kp@Qtailtrue}
-\DeclareOption{largesmallcaps} {\kp@largesmallcapstrue}
-\DeclareOption{altfligs} {\kp@altfligstrue}
-\DeclareOption{germandbls} {\kp@germandblstrue}
-\DeclareOption{eurosym} {\kp@eurosymtrue}
-\DeclareOption{harfbuzz} {\kp@harfbuzztrue}
+\DeclareOption{lighttext} {\kp@lighttexttrue}
+\DeclareOption{oldstylenums} {\kp@osntrue}
+\DeclareOption{oldstyle} {\kp@ostrue\kp@osntrue\kp@Qtailtrue}
+\DeclareOption{veryoldstyle} {\kp@vostrue\kp@osntrue\kp@Qtailtrue}
+\DeclareOption{largesmallcaps} {\kp@largesmallcapstrue}
+\DeclareOption{altfligs} {\kp@altfligstrue}
+\DeclareOption{germandbls} {\kp@germandblstrue}
+\DeclareOption{eurosym} {\kp@eurosymtrue}
+\DeclareOption{harfbuzz} {\kp@harfbuzztrue}
% Math options
-\DeclareOption{lightmath} {\kp@lightmathtrue}
-\DeclareOption{bbsans} {\kp@sfmathbbtrue}
-\DeclareOption{mathcal} {\kp@calasscrtrue}
-\DeclareOption{narrowiints} {\kp@narrowiintstrue}
-\DeclareOption{frenchstyle} {\kp@frenchstyletrue}
-\DeclareOption{partialup} {\kp@partialuptrue}
-\DeclareOption{oldstylenumsmath} {\kp@osnmtrue}
-\DeclareOption{fancyReIm} {\kp@oldReImtrue}
-\DeclareOption{noDcommand} {\kp@Dcommandfalse}
-\DeclareOption{tight} {\kp@tighttrue}
-\DeclareOption{symbols} {\kp@textfalse\kp@sffalse\kp@ttfalse
- \kp@mathfalse}
+\DeclareOption{lightmath} {\kp@lightmathtrue}
+\DeclareOption{bbsans} {\kp@sfmathbbtrue}
+\DeclareOption{mathcal} {\kp@calasscrtrue}
+\DeclareOption{narrowiints} {\kp@narrowiintstrue}
+\DeclareOption{frenchstyle} {\kp@frenchstyletrue}
+\DeclareOption{partialup} {\kp@partialuptrue}
+\DeclareOption{oldstylenumsmath} {\kp@osnmtrue}
+\DeclareOption{fancyReIm} {\kp@oldReImtrue}
+\DeclareOption{noDcommand} {\kp@Dcommandfalse}
+\DeclareOption{tight} {\kp@tighttrue}
+\DeclareOption{symbols} {\kp@textfalse\kp@sffalse\kp@ttfalse
+ \kp@mathfalse}
\ProcessOptions
-% This is adapted from babel to concatenate (rm & sf) font features.
-\def\KP@addto#1#2{%
- {\toks@\expandafter{#1,#2}%
- \xdef#1{\the\toks@}}%
-}
-\def\KP@Toptions{Ligatures=TeX}
% Concatenation of Math options.
\newtoks\KpMtoks
\newcommand*{\Store@KP@MOption}[2]{%
\KpMtoks=\expandafter{\the\KpMtoks #1={#2},}}
-% Loading Text fonts...
+% Text fonts setup...
\ifkp@text
\RequirePackage{fontspec}[2019/01/01]
+ % Two candidates for \rmfamily:
+ \newfontfamily\KpRoman{KpRoman}
+ \newfontfamily\KpLight{KpLight}
% Euro symbol
\newcommand*{\kp@euro}{\char"E990\relax}
\newcommand*{\kpeuro}[1][]{\def\@tmp{#1}%
\ifx\@tmp\@empty \kp@euro \else #1~\kp@euro\fi
}
- % Option harfbuzz is needed with HBLuaTeX to typeset composed chars
+ % Option harfbuzz is needed with HBLuaTeX to typeset some composed chars
% not ready-made in the KPfonts (f.i. ċṅṁ, ạẹịụọṃ,…).
\ifluahbtex\ifkp@harfbuzz\defaultfontfeatures+{Renderer=HarfBuzz}\fi\fi
% TS1 accent in Private Area
@@ -99,71 +99,73 @@
\ifkp@tt
\defaultfontfeatures+[\ttfamily]{Numbers=Lowercase}
\fi
- \KP@addto\KP@Toptions{Numbers=Lowercase}
+ \defaultfontfeatures+[KpRoman,KpLight,\sffamily]{Numbers=Lowercase}
\fi
%% Oldstyle
\ifkp@os
\ifkp@tt
\defaultfontfeatures+[\ttfamily]{Style=Swash}
\fi
- \KP@addto\KP@Toptions{Style=Swash,Ligatures=Rare}
+ \defaultfontfeatures+[KpRoman,KpLight,\sffamily]{Style=Swash,Ligatures=Rare}
\fi
%% Veryoldstyle
\ifkp@vos
\ifkp@tt
\defaultfontfeatures+[\ttfamily]{Style=Historic, Contextuals=Alternate}
\fi
- \KP@addto\KP@Toptions{Style=Historic, Ligatures=Historic,
- Contextuals=Alternate}
+ \defaultfontfeatures+[KpRoman,KpLight,\sffamily]{%
+ Style=Historic,Ligatures=Historic,Contextuals=Alternate}
\fi
% Smallcaps
\ifkp@largesmallcaps
- \KP@addto\KP@Toptions{SmallCapsFeatures = {Letters=SmallCaps}}
+ \defaultfontfeatures+[KpRoman,KpLight,\sffamily]{%
+ SmallCapsFeatures = {Letters=SmallCaps}}
\else
- \KP@addto\KP@Toptions{SmallCapsFeatures = {Letters=PetiteCaps}}
+ \defaultfontfeatures+[KpRoman,KpLight,\sffamily]{%
+ SmallCapsFeatures = {Letters=PetiteCaps}}
\fi
% Altfligs
\ifkp@altfligs
- \KP@addto\KP@Toptions{StylisticSet=1}
+ \defaultfontfeatures+[KpRoman,KpLight,\sffamily]{StylisticSet=1}
\fi
% Germandbls
\ifkp@germandbls
- \KP@addto\KP@Toptions{StylisticSet=2}
+ \defaultfontfeatures+[KpRoman,KpLight,\sffamily]{StylisticSet=2}
\fi
% Euro symbol
\ifkp@eurosym
\ifkp@tt
\defaultfontfeatures+[\ttfamily]{StylisticSet=3}
\fi
- \KP@addto\KP@Toptions{StylisticSet=3}
+ \defaultfontfeatures+[KpRoman,KpLight,\sffamily]{StylisticSet=3}
\fi
- % Text Serif fonts:
+ % Loading Text Serif fonts:
\ifkp@lighttext
- \setmainfont{KpLight}[\KP@Toptions]
- \newfontface\Semibold{KpRoman-Regular.otf}[\KP@Toptions]
- \newfontface\SemiboldItalic{KpRoman-Italic.otf}[\KP@Toptions]
- \newfontface\Extrabold{KpRoman-Bold.otf}[\KP@Toptions]
- \newfontface\ExtraboldItalic{KpRoman-BoldItalic.otf}[\KP@Toptions]
- \DeclareTextFontCommand{\textsb}{\Semibold}
- \DeclareTextFontCommand{\texteb}{\Extrabold}
+ \setmainfont{KpLight}
+ \renewfontfamily\KpLight{KpLight}
+ \renewfontfamily\KpRoman{KpRoman}
+ \newcommand*{\sbseries}{\KpRoman}
+ \newcommand*{\ebseries}{\KpRoman\bfseries}
+ \DeclareTextFontCommand{\textsb}{\sbseries}
+ \DeclareTextFontCommand{\texteb}{\ebseries}
\else
- \setmainfont{KpRoman}[\KP@Toptions]
- \newfontface\Light{KpRoman-Light.otf}[\KP@Toptions]
- \newfontface\LightItalic {KpRoman-LightItalic.otf}[\KP@Toptions]
- \newfontface\Semibold{KpRoman-Semibold.otf}[\KP@Toptions]
- \newfontface\SemiboldItalic{KpRoman-SemiboldItalic.otf}[\KP@Toptions]
- \DeclareTextFontCommand{\textsb}{\Semibold}
- \DeclareTextFontCommand{\textlt}{\Light}
+ \setmainfont{KpRoman}
+ \renewfontfamily\KpRoman{KpRoman}
+ \renewfontfamily\KpLight{KpLight}
+ \newcommand*{\sbseries}{\KpLight\bfseries}
+ \newcommand*{\ltseries}{\KpLight}
+ \DeclareTextFontCommand{\textsb}{\sbseries}
+ \DeclareTextFontCommand{\textlt}{\ltseries}
\fi
- % Text Sans Serif fonts:
+ % Loading Text Sans Serif fonts:
\ifkp@sf
- \setsansfont{KpSans}[\KP@Toptions]
+ \setsansfont{KpSans}
\fi
- % Text Typewriter fonts:
+ % Loading Text Typewriter fonts:
\ifkp@tt
\setmonofont{KpMono}
\fi
- % Large/Petites smallcaps
+ % Large/Petite smallcaps
\DeclareRobustCommand\lscshape{\addfontfeatures{RawFeature=+smcp}}
\DeclareRobustCommand\pscshape{\addfontfeatures{RawFeature=+pcap}}
\DeclareRobustCommand\textlsc[1]{{\lscshape #1}}
@@ -191,53 +193,48 @@
\medmuskip=2.5mu plus 1mu minus 2.5mu
\thickmuskip=3.5mu plus 2.5mu
\fi
+ \ifkp@calasscr
+ \KP@mathcal@Warning
+ \fi
+ \ifkp@sfmathbb
+ \Store@KP@MOption{RawFeature}{+ss02}
+ \fi
+ \ifkp@narrowiints
+ \Store@KP@MOption{RawFeature}{+ss03}
+ \fi
+ \ifkp@osnm
+ \Store@KP@MOption{Numbers}{Lowercase}
+ \fi
+ \ifkp@oldReIm
+ \Store@KP@MOption{RawFeature}{+cv00}
+ \fi
+ \ifkp@frenchstyle
+ \Store@KP@MOption{math-style}{french}
+ \fi
+ \ifkp@partialup
+ \Store@KP@MOption{partial}{upright}
+ \fi
\ifkp@lightmath
- \ifkp@calasscr
- \KP@mathcal@Warning
- \fi
- \ifkp@sfmathbb
- \Store@KP@MOption{RawFeature}{+ss02}
- \fi
- \ifkp@narrowiints
- \Store@KP@MOption{RawFeature}{+ss03}
- \fi
- \ifkp@osnm
- \Store@KP@MOption{Numbers}{Lowercase}
- \fi
- \ifkp@oldReIm
- \Store@KP@MOption{RawFeature}{+cv00}
- \fi
- \ifkp@frenchstyle
- \Store@KP@MOption{math-style}{french}
- \fi
- \ifkp@partialup
- \Store@KP@MOption{partial}{upright}
- \fi
- \expandafter\setmathfont\expandafter[\the\KpMtoks]{KpMath-Light.otf}
+ %\expandafter\setmathfont\expandafter[\the\KpMtoks]{KpMath-Light.otf}
+ % Following Joseph Wright in https://tex.stackexchange.com/questions/451
+ \begingroup
+ \edef\temp{%
+ \endgroup
+ \noexpand\setmathfont{KpMath-Light.otf}%
+ [\unexpanded\expandafter{\the\KpMtoks}]%
+ }
+ \temp
\setmathfont[range={cal,bfcal},RawFeature=+ss01]{KpMath-Light.otf}
\else
- \ifkp@calasscr
- \KP@mathcal@Warning
- \fi
- \ifkp@sfmathbb
- \Store@KP@MOption{RawFeature}{+ss02}
- \fi
- \ifkp@narrowiints
- \Store@KP@MOption{RawFeature}{+ss03}
- \fi
- \ifkp@osnm
- \Store@KP@MOption{Numbers}{Lowercase}
- \fi
- \ifkp@oldReIm
- \Store@KP@MOption{RawFeature}{+cv00}
- \fi
- \ifkp@frenchstyle
- \Store@KP@MOption{math-style}{french}
- \fi
- \ifkp@partialup
- \Store@KP@MOption{partial}{upright}
- \fi
- \expandafter\setmathfont\expandafter[\the\KpMtoks]{KpMath-Regular.otf}
+ %\expandafter\setmathfont\expandafter[\the\KpMtoks]{KpMath-Regular.otf}
+ % Following Joseph Wright in https://tex.stackexchange.com/questions/451
+ \begingroup
+ \edef\temp{%
+ \endgroup
+ \noexpand\setmathfont{KpMath-Regular.otf}%
+ [\unexpanded\expandafter{\the\KpMtoks}]%
+ }
+ \temp
\setmathfont[range={cal,bfcal},RawFeature=+ss01]{KpMath-Regular.otf}
\fi
\fi