summaryrefslogtreecommitdiff
path: root/fonts/xcharter/tex/XCharter.sty
diff options
context:
space:
mode:
Diffstat (limited to 'fonts/xcharter/tex/XCharter.sty')
-rw-r--r--fonts/xcharter/tex/XCharter.sty83
1 files changed, 52 insertions, 31 deletions
diff --git a/fonts/xcharter/tex/XCharter.sty b/fonts/xcharter/tex/XCharter.sty
index e4106b5b8a..b2a21b4fe6 100644
--- a/fonts/xcharter/tex/XCharter.sty
+++ b/fonts/xcharter/tex/XCharter.sty
@@ -3,16 +3,13 @@
%%
\NeedsTeXFormat{LaTeX2e}
-\def\fileversion{1.22}
-\def\filedate{2022/02/25}
+\def\fileversion{1.24}
+\def\filedate{2022/04/16}
\ProvidesPackage{XCharter}[\filedate\space v\fileversion]
\message{`XCharter' v\fileversion, \filedate\space Text macros for XCharter, an extension of Charter (msharpe)}
-\RequirePackage[T1]{fontenc}
-\RequirePackage{textcomp}
-\DeclareEncodingSubset{TS1}{XCharter-*}{0}
\RequirePackage{iftex,xkeyval,etoolbox,textcomp}
\RequirePackage{xstring,ifthen,scalefnt} % for \textfrac
\RequirePackage{mweights,xkeyval}
@@ -24,9 +21,15 @@
% Engine check
\newif\ifxch@otftext
-\iftutex\xch@otftexttrue\fi
-\newif\ifxch@nofontspec
-
+\iftutex
+ \xch@otftexttrue
+\else
+ \RequirePackage[T1]{fontenc}
+ \RequirePackage{textcomp}
+ \DeclareEncodingSubset{TS1}{XCharter-*}{0}
+\fi
+%\newif\ifxch@nofontspec
+\newif\ifxch@otfmath
% newtx check
\newif\ifntx@newtx
\@ifundefined{ntx@otftexttrue}{% not run from newtx.sty
@@ -54,7 +57,7 @@
\@nameuse{if#1}\xch@otftextfalse\fi
}
\DeclareOptionX{nofontspec}[true]{% type1 + don't load fontspec
-\@nameuse{if#1}\xch@nofontspectrue\fi
+%\@nameuse{if#1}\xch@nofontspectrue\fi % No effect from 1.24 onward
}
\def\xch@defaultfeatures{}
\DeclareOptionX{defaultfeatures}{\def\xch@defaultfeatures{#1}}
@@ -63,6 +66,10 @@
\def\xch@dfltfigurestyle{lf}
\def\xch@dfltfigurealign{t}
+\DeclareOptionX{otfmath}[true]{%
+\@nameuse{xch@otfmath#1}
+}
+
\DeclareOptionX{lining}[true]{%
\@nameuse{xch@lining#1}
}
@@ -124,6 +131,7 @@
%Scale
\providecommand*{\XCharter@scale}{1}% Might have been defined in newtx
+\DeclareOptionX{Scale}{\renewcommand*{\XCharter@scale}{#1}}
\DeclareOptionX{scale}{\renewcommand*{\XCharter@scale}{#1}}
\DeclareOptionX{scaled}{\renewcommand*{\XCharter@scale}{#1}}
@@ -162,6 +170,8 @@
%\DeclareOptionX{proportional}{\useproportional}
%\def\xch@fnmark{}
%\DeclareOptionX{fnmarkerfont}{\def\xch@fnmark{#1}}
+\newif\ifxch@notextnu
+\DeclareOptionX{notextnu}{\xch@notextnutrue}
\DeclareOptionX{defaultfeatures}{\def\xch@defaultfeatures{#1}}
\DeclareOptionX{oldSS}{\advance\xch@cnt\@ne}
\DeclareOptionX{theoremfont}{\xch@thrmtrue}
@@ -171,21 +181,29 @@
\DeclareOptionX{scosf}{\xch@scosftrue}
\DeclareOptionX{foresolidus}{\gdef\XCharter@foresolidus{#1}}
\DeclareOptionX{aftsolidus}{\gdef\XCharter@aftsolidus{#1}}
+\DeclareOptionX*{\ifxch@otfmath\PassOptionsToPackage{\CurrentOption}{xcharter-otf}\fi}
\ExecuteOptionsX{lining,tabular}
\ProcessOptionsX\relax
+%+++++++++++++++++Option consequences++++++++++++++++++++++++
+
% Check for conflict between nofontspec and others
-\ifxch@nofontspec
- \iftutex
- \xch@otftextfalse
- \fi
-\fi
+%\ifxch@nofontspec
+% \iftutex
+% \xch@otftextfalse
+% \fi
+%\fi
%\edef\xch@scaled{s*[\xch@scale]}% used in fd files
\iftutex
- \ifxch@nofontspec % do nothing
- \else
+ \ifxch@otfmath
+ \RequirePackage{fontspec}
+ \RequirePackage[Scale=\XCharter@scale]{xcharter-otf}
+ %\setmathfont{XCharter-Math.otf}
+ \else % set up for minxcharter+newtxmath, then otf XCharter
\RequirePackage[no-math]{fontspec}
+ \let\ntxmath@scale=\XCharter@scale
+
\fi
\fi
@@ -241,8 +259,8 @@
\fa@naming@exception{figures}{{numerators}{tabular}}{Numr}
\def\nufigures{\@nomath\nufigures%
\fontfigurestyle{numerators}\selectfont}
- \DeclareTextFontCommand{\textnu}{\nufigures}
- \let\textnumerator\textnu
+ \DeclareTextFontCommand{\textnumerator}{\nufigures}
+ %\let\textnum\textnumerator
\fa@naming@exception{figures}{{denominators}{proportional}}{Dnom}
\fa@naming@exception{figures}{{denominators}{tabular}}{Dnom}
@@ -352,7 +370,7 @@
%\newcommand{\textosf}[1]{{\fontencoding{T1}\fontfamily{XCharterx}\selectfont #1}}% to get XCharter osf
%\newcommand{\textosfI}[1]{{\fontencoding{T1}\fontfamily{XChartery}\selectfont #1}}% to get XCharter osfI
-\renewcommand*{\bfdefault}{b}
+%\renewcommand*{\bfdefault}{b}
\renewcommand*{\scdefault}{sc}% for better compatibility with mathdesign
% The following are provided so that we may access osf in any mode
@@ -478,7 +496,7 @@
\not@math@alphabet\osfstyle\relax
\addfontfeatures{Numbers={Proportional,OldStyle}}%
}
- \DeclareRobustCommand{\tosfstyle}{%
+ \DeclareRobustCommand{\tosfstyle}{%
\not@math@alphabet\tosfstyle\relax
\addfontfeatures{Numbers={Monospaced,OldStyle}}%
}
@@ -547,15 +565,7 @@
\providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}}
\providecommand\defigures{\addfontfeatures{RawFeature=+dnom}}
\providecommand\infigures{\addfontfeatures{VerticalPosition=Inferior}}
- \let\nustyle\nufigures
- \DeclareTextFontCommand{\textnu}{\nufigures}
- \let\destyle\defigures
- \DeclareTextFontCommand{\textsu}{\sufigures}
- \let\textsuperior\textsu
- \DeclareTextFontCommand{\textde}{\defigures}
- \let\textdenominator\textde
- \DeclareTextFontCommand{\textinf}{\infigures}
- \let\textinferior\textinf
+% \let\nustyle\nufigures
\ifxch@sups %
\usepackage{realscripts}
@@ -581,7 +591,7 @@
%}
%\let\textthit\textth
\renewcommand*{\rmdefault}{XCharter-TLF} % always TLF in math
- \renewcommand*{\familydefault}{\rmdefault}
+ %\renewcommand*{\familydefault}{\rmdefault}
\ifxch@sups %
\ifxch@KOMA %
@@ -629,6 +639,7 @@
BoldItalicFont = *-BoldItalic ,
BoldSlantedFont= *-BoldSlanted ,
SmallCapsFeatures={Letters=SmallCaps} ,
+ \if1\XCharter@altone CharacterVariant={1:0}\fi
] {\xch@base}
\def\xch@sty{\xch@figurestyle}\def\xch@fa{\xch@figurealign}
\if l\xch@thmlin\def\xch@sty{Lining}\def\xch@fa{Tabular}\fi
@@ -688,12 +699,22 @@
\newcommand*{\thdefault}{XCharterTH-\xch@thfigurestyle}
\normalfont
- \renewcommand*{\familydefault}{\rmdefault}
+ %\renewcommand*{\familydefault}{\rmdefault}
\let\textthit\textth
}
\fi
%both
+\let\nustyle\nufigures
+\let\textnum\textnumerator
+\ifxch@notextnu\else\let\textnu=\textnumerator\fi
+\let\destyle\defigures
+\DeclareTextFontCommand{\textsu}{\sufigures}
+\let\textsuperior\textsu
+\DeclareTextFontCommand{\textde}{\defigures}
+\let\textdenominator\textde
+\DeclareTextFontCommand{\textinf}{\infigures}
+\let\textinferior\textinf
\DeclareTextFontCommand{\textosf}{\osfstyle}
\DeclareTextFontCommand{\texttosf}{\tosfstyle}
\DeclareTextFontCommand{\texttlf}{\tlfstyle}