\NeedsTeXFormat{LaTeX2e}[2022/06/01]
\def\fileversion{0.74}
\def\filedate{2026-03-23}
\ProvidesPackage{xcharter-otf}[\filedate\space\fileversion]

% Ensure luatex or xetex engine
\RequirePackage{iftex}[2019/10/24]
\RequireTUTeX

\newtoks\XCottoksT
\newtoks\XCottoksM
\newcommand*{\XCstore@KV@Option}[2]{%
  \def\XCot@scale{Scale}\def\XCot@opt{#1}%
  \ifx\XCot@opt\XCot@scale\XCottoksT={Scale={#2}}\fi
  \XCottoksM=\expandafter{\the\XCottoksM #1={#2},}}

% Package options:
\DeclareKeys
  {
   lum.if                = XCot@lum                                ,
   no-text.if            = XCot@notext                              ,
   no-logos.if           = XCot@nologos                             ,
   fakedscripts.if       = XCot@fakedscripts                        ,
   tight.if              = XCot@tight                               ,
   loose.code            = \XCot@tightfalse                         ,
   fulloldstyle.code     = \XCstore@KV@Option{Numbers}{OldStyle}    ,
   math-style.code       = \XCstore@KV@Option{math-style}{#1}       ,
   bold-style.code       = \XCstore@KV@Option{bold-style}{#1}       ,
   nabla.code            = \XCstore@KV@Option{nabla}{#1}            ,
   partial.code          = \XCstore@KV@Option{partial}{#1}          ,
   CharacterVariant.code = \XCstore@KV@Option{CharacterVariant}{#1} ,
   StylisticSet.code     = \XCstore@KV@Option{StylisticSet}{#1}     ,
   Style.code            = \XCstore@KV@Option{Style}{#1}            ,
   Scale.code            = \XCstore@KV@Option{Scale}{#1}
  }
%
\XCot@tighttrue
\ProcessKeyOptions
%
\ifxetex  \RequirePackage{unicode-math}\fi
\ifluatex
  \ifXCot@lum \RequirePackage{fontspec,lua-unicode-math}
  \else       \RequirePackage{unicode-math}
  \fi
\fi
%
\newopentypefeature{Style}{mathcal}{+ss01}
\newopentypefeature{Style}{upint}{+ss03}
\newopentypefeature{Style}{leqslant}{+ss04}
\newopentypefeature{Style}{smaller}{+ss05}
\newopentypefeature{Style}{subsetneq}{+ss06}
\newopentypefeature{Style}{parallelslant}{+ss07}
%
% Math fonts: XCharter-Math.otf
% Following Joseph Wright in https://tex.stackexchange.com/questions/451
\XCstore@KV@Option{BoldFont}{XCharter-Math-Bold.otf}
\begingroup
  \edef\temp{%
    \endgroup
    \noexpand\setmathfont{XCharter-Math.otf}%
    [\unexpanded\expandafter{\the\XCottoksM}]%
  }
  \temp
%
\ifXCot@lum
  \DeclareSymbolFont {lummain}{TU}{xcharter-math}{m}{n}
  \SetSymbolFont {lummain}{bold}{TU}{xcharter-math}{b}{n}
\fi
%
\ifXCot@tight
  \thinmuskip=2mu
  \medmuskip=2.5mu plus 1mu minus 2.5mu
  \thickmuskip=3.5mu plus 2.5mu
\fi
% Text Serif fonts: XCharter with possible scaling.
\ifXCot@notext
\else
  \ifXCot@fakedscripts\else \RequirePackage{realscripts}\fi
  \setmainfont{XCharter}[\unexpanded\expandafter{\the\XCottoksT}]
  % Fine tune TeX logos for the XCharter fonts
  \ifXCot@nologos
  \else
    \DeclareRobustCommand{\TeX}{T\kern -.15em\lower .4ex
      \hbox{E}\kern -.05emX\@}
    \DeclareRobustCommand{\LaTeX}{L\kern -.25em
      \raisebox{.38ex}{\textsc{a}}\kern -.1em\TeX}
    \DeclareRobustCommand{\LaTeXe}{\LaTeX
      \kern .05em2\raisebox{-.35ex}{\char"03B5}}
  \fi
\fi

% Text Sans Serif fonts: default (lmss unless specified)
% Text Typewriter fonts: default (lmtt unless specified)

\AtBeginDocument{%
  % XCharter specific math
  % \Umathchardef\<cmd> = <math type> <family> <slot>
  % <math type> : \mathord=0 \mathrel=3 ; <family>=0
  \Umathchardef\mupvarzero =          0 0 "E000 \relax
  \Umathchardef\varemptyset =         0 0 "E001 \relax
  \Umathchardef\simlessslant =        3 0 "E009 \relax
  \Umathchardef\simgtrslant =         3 0 "E00A \relax
  \Umathchardef\smteslant =           3 0 "E00B \relax
  \Umathchardef\lateslant =           3 0 "E00C \relax
  \Umathchardef\mbfitvarw =           0 0 "E01C \relax
  \Umathchardef\mitvarw =             0 0 "E01D \relax
  \Umathchardef\mbfitvarv =           0 0 "E01E \relax
  \Umathchardef\mitvarv =             0 0 "E01F \relax
  \Umathchardef\mbfvarzero =          0 0 "E023 \relax
  \Umathchardef\varpropto =           0 0 "E02F \relax
  \Umathchardef\mbfdotlessi =         0 0 "E046 \relax
  \Umathchardef\mbfdotlessj =         0 0 "E047 \relax
  \Umathchardef\mbfimath =            0 0 "E066 \relax
  \Umathchardef\mbfjmath =            0 0 "E067 \relax
  \Umathchardef\mithbar =             0 0 "E078 \relax
  \Umathchardef\varsymscrE =          0 0 "E07D \relax
  \Umathchardef\varsymscrQ =          0 0 "E07E \relax
  \Umathchardef\varsymscrT =          0 0 "E07F \relax
  \Umathchardef\varsymbfscrE =        0 0 "E06D \relax
  \Umathchardef\varsymbfscrQ =        0 0 "E06E \relax
  \Umathchardef\varsymbfscrT =        0 0 "E06F \relax
  \Umathchardef\mapstochar =          3 0 "E08D \relax
  \Umathchardef\lhook =               3 0 "E08E \relax
  \Umathchardef\rhook =               3 0 "E08F \relax
  \Umathchardef\parallelslant  =      3 0 "E090 \relax
  \Umathchardef\nparallelslant =      3 0 "E091 \relax
  \Umathchardef\shortparallelslant =  3 0 "E092 \relax
  \Umathchardef\nshortparallelslant = 3 0 "E093 \relax
  \Umathchardef\lesseqslantgtr =      3 0 "E094 \relax
  \Umathchardef\gtreqslantless =      3 0 "E095 \relax
  \Umathchardef\lesseqqslantgtr =     3 0 "E096 \relax
  \Umathchardef\gtreqqslantless =     3 0 "E097 \relax
  \Umathchardef\nleqqslant =          3 0 "E098 \relax
  \Umathchardef\ngeqqslant =          3 0 "E099 \relax
  \Umathchardef\lesssimslant =        3 0 "E09A \relax
  \Umathchardef\gtrsimslant =         3 0 "E09B \relax
 % \widearc and\overrightarc
  \providecommand*{\widearc}{\Umathaccent 0 0 "E540 }%
  \providecommand*{\overrightarc}{\Umathaccent 0 0 "20D5 }%
  % Greek sans-serif glyphs in Private Area (temporary fix)
  \Umathchardef\msansAlpha =          0 0 "E741 \relax
  \Umathchardef\msansBeta =           0 0 "E742 \relax
  \Umathchardef\msansGamma =          0 0 "E743 \relax
  \Umathchardef\msansDelta =          0 0 "E744 \relax
  \Umathchardef\msansEpsilon =        0 0 "E745 \relax
  \Umathchardef\msansZeta =           0 0 "E746 \relax
  \Umathchardef\msansEta =            0 0 "E747 \relax
  \Umathchardef\msansTheta =          0 0 "E748 \relax
  \Umathchardef\msansIota =           0 0 "E749 \relax
  \Umathchardef\msansKappa =          0 0 "E74A \relax
  \Umathchardef\msansLambda =         0 0 "E74B \relax
  \Umathchardef\msansMu =             0 0 "E74C \relax
  \Umathchardef\msansNu =             0 0 "E74D \relax
  \Umathchardef\msansXi =             0 0 "E74E \relax
  \Umathchardef\msansOmicron =        0 0 "E74F \relax
  \Umathchardef\msansPi =             0 0 "E750 \relax
  \Umathchardef\msansRho =            0 0 "E751 \relax
  \Umathchardef\msansvarTheta =       0 0 "E752 \relax
  \Umathchardef\msansSigma =          0 0 "E753 \relax
  \Umathchardef\msansTau =            0 0 "E754 \relax
  \Umathchardef\msansUpsilon =        0 0 "E755 \relax
  \Umathchardef\msansPhi =            0 0 "E756 \relax
  \Umathchardef\msansChi =            0 0 "E757 \relax
  \Umathchardef\msansPsi =            0 0 "E758 \relax
  \Umathchardef\msansOmega =          0 0 "E759 \relax
  \Umathchardef\msansnabla =          0 0 "E75A \relax
  \Umathchardef\msansalpha =          0 0 "E761 \relax
  \Umathchardef\msansbeta  =          0 0 "E762 \relax
  \Umathchardef\msansgamma =          0 0 "E763 \relax
  \Umathchardef\msansdelta =          0 0 "E764 \relax
  \Umathchardef\msansvarepsilon =     0 0 "E765 \relax
  \Umathchardef\msanszeta =           0 0 "E766 \relax
  \Umathchardef\msanseta =            0 0 "E767 \relax
  \Umathchardef\msanstheta =          0 0 "E768 \relax
  \Umathchardef\msansiota =           0 0 "E769 \relax
  \Umathchardef\msanskappa =          0 0 "E76A \relax
  \Umathchardef\msanslambda =         0 0 "E76B \relax
  \Umathchardef\msansmu =             0 0 "E76C \relax
  \Umathchardef\msansnu =             0 0 "E76D \relax
  \Umathchardef\msansxi =             0 0 "E76E \relax
  \Umathchardef\msansomicron =        0 0 "E76F \relax
  \Umathchardef\msanspi =             0 0 "E770 \relax
  \Umathchardef\msansrho =            0 0 "E771 \relax
  \Umathchardef\msansvarsigma =       0 0 "E772 \relax
  \Umathchardef\msanssigma =          0 0 "E773 \relax
  \Umathchardef\msanstau =            0 0 "E774 \relax
  \Umathchardef\msansupsilon =        0 0 "E775 \relax
  \Umathchardef\msansphi =            0 0 "E776 \relax
  \Umathchardef\msanschi =            0 0 "E777 \relax
  \Umathchardef\msanspsi =            0 0 "E778 \relax
  \Umathchardef\msansomega =          0 0 "E779 \relax
  \Umathchardef\msanspartial =        0 0 "E77A \relax
  \Umathchardef\msansepsilon =        0 0 "E77B \relax
  \Umathchardef\msansvartheta =       0 0 "E77C \relax
  \Umathchardef\msansvarkappa =       0 0 "E77D \relax
  \Umathchardef\msansvarphi =         0 0 "E77E \relax
  \Umathchardef\msansvarrho =         0 0 "E77F \relax
  \Umathchardef\msansvarpi =          0 0 "E780 \relax
  \Umathchardef\mitsansAlpha =        0 0 "E791 \relax
  \Umathchardef\mitsansBeta =         0 0 "E792 \relax
  \Umathchardef\mitsansGamma =        0 0 "E793 \relax
  \Umathchardef\mitsansDelta =        0 0 "E794 \relax
  \Umathchardef\mitsansEpsilon =      0 0 "E795 \relax
  \Umathchardef\mitsansZeta =         0 0 "E796 \relax
  \Umathchardef\mitsansEta =          0 0 "E797 \relax
  \Umathchardef\mitsansTheta =        0 0 "E798 \relax
  \Umathchardef\mitsansIota =         0 0 "E799 \relax
  \Umathchardef\mitsansKappa =        0 0 "E79A \relax
  \Umathchardef\mitsansLambda =       0 0 "E79B \relax
  \Umathchardef\mitsansMu =           0 0 "E79C \relax
  \Umathchardef\mitsansNu =           0 0 "E79D \relax
  \Umathchardef\mitsansXi =           0 0 "E79E \relax
  \Umathchardef\mitsansOmicron =      0 0 "E79F \relax
  \Umathchardef\mitsansPi =           0 0 "E7A0 \relax
  \Umathchardef\mitsansRho =          0 0 "E7A1 \relax
  \Umathchardef\mitsansvarTheta =     0 0 "E7A2 \relax
  \Umathchardef\mitsansSigma =        0 0 "E7A3 \relax
  \Umathchardef\mitsansTau =          0 0 "E7A4 \relax
  \Umathchardef\mitsansUpsilon =      0 0 "E7A5 \relax
  \Umathchardef\mitsansPhi =          0 0 "E7A6 \relax
  \Umathchardef\mitsansChi =          0 0 "E7A7 \relax
  \Umathchardef\mitsansPsi =          0 0 "E7A8 \relax
  \Umathchardef\mitsansOmega =        0 0 "E7A9 \relax
  \Umathchardef\mitsansnabla =        0 0 "E7AA \relax
  \Umathchardef\mitsansalpha =        0 0 "E7B1 \relax
  \Umathchardef\mitsansbeta  =        0 0 "E7B2 \relax
  \Umathchardef\mitsansgamma =        0 0 "E7B3 \relax
  \Umathchardef\mitsansdelta =        0 0 "E7B4 \relax
  \Umathchardef\mitsansvarepsilon =   0 0 "E7B5 \relax
  \Umathchardef\mitsanszeta =         0 0 "E7B6 \relax
  \Umathchardef\mitsanseta =          0 0 "E7B7 \relax
  \Umathchardef\mitsanstheta =        0 0 "E7B8 \relax
  \Umathchardef\mitsansiota =         0 0 "E7B9 \relax
  \Umathchardef\mitsanskappa =        0 0 "E7BA \relax
  \Umathchardef\mitsanslambda =       0 0 "E7BB \relax
  \Umathchardef\mitsansmu =           0 0 "E7BC \relax
  \Umathchardef\mitsansnu =           0 0 "E7BD \relax
  \Umathchardef\mitsansxi =           0 0 "E7BE \relax
  \Umathchardef\mitsansomicron =      0 0 "E7BF \relax
  \Umathchardef\mitsanspi =           0 0 "E7C0 \relax
  \Umathchardef\mitsansrho =          0 0 "E7C1 \relax
  \Umathchardef\mitsansvarsigma =     0 0 "E7C2 \relax
  \Umathchardef\mitsanssigma =        0 0 "E7C3 \relax
  \Umathchardef\mitsanstau =          0 0 "E7C4 \relax
  \Umathchardef\mitsansupsilon =      0 0 "E7C5 \relax
  \Umathchardef\mitsansphi =          0 0 "E7C6 \relax
  \Umathchardef\mitsanschi =          0 0 "E7C7 \relax
  \Umathchardef\mitsanspsi =          0 0 "E7C8 \relax
  \Umathchardef\mitsansomega =        0 0 "E7C9 \relax
  \Umathchardef\mitsanspartial =      0 0 "E7CA \relax
  \Umathchardef\mitsansepsilon =      0 0 "E7CB \relax
  \Umathchardef\mitsansvartheta =     0 0 "E7CC \relax
  \Umathchardef\mitsansvarkappa =     0 0 "E7CD \relax
  \Umathchardef\mitsansvarphi =       0 0 "E7CE \relax
  \Umathchardef\mitsansvarrho =       0 0 "E7CF \relax
  \Umathchardef\mitsansvarpi =        0 0 "E7D0 \relax
  % amssymb
  \@ifpackageloaded{amssymb}%
    {\PackageWarning{xcharter-otf}{%
       XCharter-Math provides all AMS symbols.\MessageBreak
       Loading amssymb.sty is not advisable.\MessageBreak
       Reported}%
    }%
    {% AMS Symbols not referenced in unicode-math-table.tex
     % \Umathchardef\<cmd> = <math type> <family> <slot>
     % <math type> : \mathord=0 \mathrel=3 ; <family>=0
     \Umathchardef\circledR =       0 0 "24C7 \relax
     \Umathchardef\circledS =       0 0 "24C8 \relax
     \Umathchardef\diagup =         0 0 "27CB \relax
     \Umathchardef\diagdown =       0 0 "27CD \relax
     \Umathchardef\shortmid =       3 0 "E0A2 \relax
     \Umathchardef\shortparallel =  3 0 "E0A3 \relax
     \Umathchardef\nshortmid =      3 0 "E0A4 \relax
     \Umathchardef\nshortparallel = 3 0 "E0A5 \relax
     \Umathchardef\lvertneqq =      3 0 "E0A6 \relax
     \Umathchardef\gvertneqq =      3 0 "E0A7 \relax
     \Umathchardef\nleqslant =      3 0 "E0A8 \relax
     \Umathchardef\ngeqslant =      3 0 "E0A9 \relax
     \Umathchardef\nleqq =          3 0 "E0AA \relax
     \Umathchardef\ngeqq =          3 0 "E0AB \relax
     \Umathchardef\varsubsetneq =   3 0 "E0AC \relax
     \Umathchardef\varsupsetneq =   3 0 "E0AD \relax
     \Umathchardef\nsubseteqq =     3 0 "E0AE \relax
     \Umathchardef\nsupseteqq =     3 0 "E0AF \relax
     \Umathchardef\varsubsetneqq =  3 0 "E09C \relax
     \Umathchardef\varsupsetneqq =  3 0 "E09D \relax
     \Umathchardef\npreceq =        3 0 "E09E \relax
     \Umathchardef\nsucceq =        3 0 "E09F \relax
     \protected\def\centerdot{\cdotp}%
     \protected\def\restriction{\upharpoonright}%
     \protected\def\doteqdot{\Doteq}%
     \protected\def\doublecup{\Cup}%
     \protected\def\doublecap{\Cap}%
     \protected\def\llless{\lll}%
     \protected\def\gggtr{\ggg}%
     \protected\def\circlearrowleft{\acwopencirclearrow}%
     \protected\def\circlearrowright{\cwopencirclearrow}%
     \protected\def\lozenge{\mdlgwhtlozenge}%
     \protected\def\blacklozenge{\mdlgblklozenge}%
     \protected\def\square{\mdlgwhtsquare}%
     \protected\def\blacksquare{\mdlgblksquare}%
     \protected\def\dashleftarrow{\leftdasharrow}%
     \protected\def\dashrightarrow{\rightdasharrow}%
     \protected\def\ntriangleleft{\nvartriangleleft}%
     \protected\def\ntriangleright{\nvartriangleright}%
     \protected\def\varpropto{\propto}%
     \protected\def\thicksim{\sim}%
     \protected\def\thickapprox{\approx}%
     \protected\def\smallsmile{\smile}%
     \protected\def\smallfrown{\frown}%
    }%
  % latexsym
  \@ifpackageloaded{latexsym}%
    {\PackageWarning{xcharter-otf}{%
       XCharter-Math provides all LaTeX symbols.\MessageBreak
       Loading latexsym.sty is not advisable.\MessageBreak
       Reported}%
    }%
    {\protected\def\lhd{\vartriangleleft}%
     \protected\def\rhd{\vartriangleright}%
     \protected\def\unlhd{\trianglelefteq}%
     \protected\def\unrhd{\trianglerighteq}%
     \protected\def\leadsto{\rightcurvedarrow}%
     \protected\def\Box{\lgwhtsquare}%
     \protected\def\Diamond{\mdlgwhtdiamond}%
    }%
}

\endinput
