\NeedsTeXFormat{LaTeX2e}[2022/06/01]
\def\fileversion{0.75}
\def\filedate{2026-08-26}
\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} \XCot@lumfalse\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@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 and true superscripts.
\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)

%  For AMS symbols with lua-unicode-math.
\ifXCot@lum
  \RequirePackage{amssymb}
\fi
% Missing Math symbols definitions
\newcount\XCot@fam
\AtBeginDocument{%
  \ifluatex \XCot@fam=\Umathcharfam"30 \fi
  % For both unicode-math and lua-unicode-math:
  % Avoid (way too thin) AMS symbols for the next seven chars.
  \protected\def\thicksim{\sim}%
  \protected\def\thickapprox{\approx}%
  \protected\def\smallfrown{\frown}%
  \protected\def\smallsmile{\smile}%
  % \Umathchardef\<cmd> = <math type> <family> <slot>
  % <math type> : \mathord=0 \mathbin=2  \mathrel=3 ; <family>
  \Umathchardef\circledR  =           0 \the\XCot@fam "24C7 \relax
  \Umathchardef\circledS  =           0 \the\XCot@fam "24C8 \relax
  \Umathchardef\mupvarzero =          0 \the\XCot@fam "E000 \relax
  \Umathchardef\varemptyset =         0 \the\XCot@fam "E001 \relax
  \Umathchardef\simlessslant =        3 \the\XCot@fam "E009 \relax
  \Umathchardef\simgtrslant =         3 \the\XCot@fam "E00A \relax
  \Umathchardef\smteslant =           3 \the\XCot@fam "E00B \relax
  \Umathchardef\lateslant =           3 \the\XCot@fam "E00C \relax
  \Umathchardef\varsubsetneq =        3 \the\XCot@fam "E010 \relax
  \Umathchardef\varsupsetneq =        3 \the\XCot@fam "E011 \relax
  \Umathchardef\varsubsetneqq =       3 \the\XCot@fam "E012 \relax
  \Umathchardef\varsupsetneqq =       3 \the\XCot@fam "E013 \relax
  \Umathchardef\lesseqslantgtr =      3 \the\XCot@fam "E014 \relax
  \Umathchardef\gtreqslantless =      3 \the\XCot@fam "E015 \relax
  \Umathchardef\lesseqqslantgtr =     3 \the\XCot@fam "E016 \relax
  \Umathchardef\gtreqqslantless =     3 \the\XCot@fam "E017 \relax
  \Umathchardef\lesssimslant =        3 \the\XCot@fam "E019 \relax
  \Umathchardef\gtrsimslant =         3 \the\XCot@fam "E01A \relax
  \Umathchardef\lvertneqq =           3 \the\XCot@fam "E01B \relax
  \Umathchardef\gvertneqq =           3 \the\XCot@fam "E01C \relax
  \Umathchardef\mbfvarzero =          0 \the\XCot@fam "E023 \relax
  \Umathchardef\varpropto =           3 \the\XCot@fam "E028 \relax
  \Umathchardef\mbfitvarw =           0 \the\XCot@fam "E02C \relax
  \Umathchardef\mitvarw =             0 \the\XCot@fam "E02D \relax
  \Umathchardef\mbfitvarv =           0 \the\XCot@fam "E02E \relax
  \Umathchardef\mitvarv =             0 \the\XCot@fam "E02F \relax
  \Umathchardef\mbfdotlessi =         0 \the\XCot@fam "E046 \relax
  \Umathchardef\mbfdotlessj =         0 \the\XCot@fam "E047 \relax
  \Umathchardef\mbfimath =            0 \the\XCot@fam "E066 \relax
  \Umathchardef\mbfjmath =            0 \the\XCot@fam "E067 \relax
  \Umathchardef\varsymbfscrE =        0 \the\XCot@fam "E06D \relax
  \Umathchardef\varsymbfscrQ =        0 \the\XCot@fam "E06E \relax
  \Umathchardef\varsymbfscrT =        0 \the\XCot@fam "E06F \relax
  \Umathchardef\mithbar =             0 \the\XCot@fam "E078 \relax
  \Umathchardef\varsymscrE =          0 \the\XCot@fam "E07D \relax
  \Umathchardef\varsymscrQ =          0 \the\XCot@fam "E07E \relax
  \Umathchardef\varsymscrT =          0 \the\XCot@fam "E07F \relax
  \Umathchardef\mapstochar =          3 \the\XCot@fam "E08D \relax
  \Umathchardef\lhook =               3 \the\XCot@fam "E08E \relax
  \Umathchardef\rhook =               3 \the\XCot@fam "E08F \relax
  \Umathchardef\parallelslant  =      3 \the\XCot@fam "E090 \relax
  \Umathchardef\nparallelslant =      3 \the\XCot@fam "E091 \relax
  \Umathchardef\shortparallelslant =  3 \the\XCot@fam "E092 \relax
  \Umathchardef\nshortparallelslant = 3 \the\XCot@fam "E093 \relax
  \Umathchardef\nleqqslant =          3 \the\XCot@fam "E098 \relax
  \Umathchardef\ngeqqslant =          3 \the\XCot@fam "E099 \relax
  \Umathchardef\npreceq =             3 \the\XCot@fam "E09E \relax
  \Umathchardef\nsucceq =             3 \the\XCot@fam "E09F \relax
  \Umathchardef\smallsetminus  =      2 \the\XCot@fam "E0A0 \relax
  \Umathchardef\shortmid       =      3 \the\XCot@fam "E0A2 \relax
  \Umathchardef\shortparallel  =      3 \the\XCot@fam "E0A3 \relax
  \Umathchardef\nshortmid      =      3 \the\XCot@fam "E0A4 \relax
  \Umathchardef\nshortparallel =      3 \the\XCot@fam "E0A5\relax
  \Umathchardef\nleqslant =           3 \the\XCot@fam "E0A8 \relax
  \Umathchardef\ngeqslant =           3 \the\XCot@fam "E0A9 \relax
  \Umathchardef\nleqq =               3 \the\XCot@fam "E0AA \relax
  \Umathchardef\ngeqq =               3 \the\XCot@fam "E0AB \relax
  \Umathchardef\nsubseteqq =          3 \the\XCot@fam "E0AE \relax
  \Umathchardef\nsupseteqq =          3 \the\XCot@fam "E0AF \relax
  % \widearc and\overrightarc
  \providecommand*{\widearc}{\Umathaccent 0 \the\XCot@fam "E540 }%
  \providecommand*{\overrightarc}{\Umathaccent 0 \the\XCot@fam "20D5 }%
  % Greek sans-serif glyphs in Private Area (temporary fix)
  \Umathchardef\msansAlpha =          0 \the\XCot@fam "E741 \relax
  \Umathchardef\msansBeta =           0 \the\XCot@fam "E742 \relax
  \Umathchardef\msansGamma =          0 \the\XCot@fam "E743 \relax
  \Umathchardef\msansDelta =          0 \the\XCot@fam "E744 \relax
  \Umathchardef\msansEpsilon =        0 \the\XCot@fam "E745 \relax
  \Umathchardef\msansZeta =           0 \the\XCot@fam "E746 \relax
  \Umathchardef\msansEta =            0 \the\XCot@fam "E747 \relax
  \Umathchardef\msansTheta =          0 \the\XCot@fam "E748 \relax
  \Umathchardef\msansIota =           0 \the\XCot@fam "E749 \relax
  \Umathchardef\msansKappa =          0 \the\XCot@fam "E74A \relax
  \Umathchardef\msansLambda =         0 \the\XCot@fam "E74B \relax
  \Umathchardef\msansMu =             0 \the\XCot@fam "E74C \relax
  \Umathchardef\msansNu =             0 \the\XCot@fam "E74D \relax
  \Umathchardef\msansXi =             0 \the\XCot@fam "E74E \relax
  \Umathchardef\msansOmicron =        0 \the\XCot@fam "E74F \relax
  \Umathchardef\msansPi =             0 \the\XCot@fam "E750 \relax
  \Umathchardef\msansRho =            0 \the\XCot@fam "E751 \relax
  \Umathchardef\msansvarTheta =       0 \the\XCot@fam "E752 \relax
  \Umathchardef\msansSigma =          0 \the\XCot@fam "E753 \relax
  \Umathchardef\msansTau =            0 \the\XCot@fam "E754 \relax
  \Umathchardef\msansUpsilon =        0 \the\XCot@fam "E755 \relax
  \Umathchardef\msansPhi =            0 \the\XCot@fam "E756 \relax
  \Umathchardef\msansChi =            0 \the\XCot@fam "E757 \relax
  \Umathchardef\msansPsi =            0 \the\XCot@fam "E758 \relax
  \Umathchardef\msansOmega =          0 \the\XCot@fam "E759 \relax
  \Umathchardef\msansnabla =          0 \the\XCot@fam "E75A \relax
  \Umathchardef\msansalpha =          0 \the\XCot@fam "E761 \relax
  \Umathchardef\msansbeta  =          0 \the\XCot@fam "E762 \relax
  \Umathchardef\msansgamma =          0 \the\XCot@fam "E763 \relax
  \Umathchardef\msansdelta =          0 \the\XCot@fam "E764 \relax
  \Umathchardef\msansvarepsilon =     0 \the\XCot@fam "E765 \relax
  \Umathchardef\msanszeta =           0 \the\XCot@fam "E766 \relax
  \Umathchardef\msanseta =            0 \the\XCot@fam "E767 \relax
  \Umathchardef\msanstheta =          0 \the\XCot@fam "E768 \relax
  \Umathchardef\msansiota =           0 \the\XCot@fam "E769 \relax
  \Umathchardef\msanskappa =          0 \the\XCot@fam "E76A \relax
  \Umathchardef\msanslambda =         0 \the\XCot@fam "E76B \relax
  \Umathchardef\msansmu =             0 \the\XCot@fam "E76C \relax
  \Umathchardef\msansnu =             0 \the\XCot@fam "E76D \relax
  \Umathchardef\msansxi =             0 \the\XCot@fam "E76E \relax
  \Umathchardef\msansomicron =        0 \the\XCot@fam "E76F \relax
  \Umathchardef\msanspi =             0 \the\XCot@fam "E770 \relax
  \Umathchardef\msansrho =            0 \the\XCot@fam "E771 \relax
  \Umathchardef\msansvarsigma =       0 \the\XCot@fam "E772 \relax
  \Umathchardef\msanssigma =          0 \the\XCot@fam "E773 \relax
  \Umathchardef\msanstau =            0 \the\XCot@fam "E774 \relax
  \Umathchardef\msansupsilon =        0 \the\XCot@fam "E775 \relax
  \Umathchardef\msansphi =            0 \the\XCot@fam "E776 \relax
  \Umathchardef\msanschi =            0 \the\XCot@fam "E777 \relax
  \Umathchardef\msanspsi =            0 \the\XCot@fam "E778 \relax
  \Umathchardef\msansomega =          0 \the\XCot@fam "E779 \relax
  \Umathchardef\msanspartial =        0 \the\XCot@fam "E77A \relax
  \Umathchardef\msansepsilon =        0 \the\XCot@fam "E77B \relax
  \Umathchardef\msansvartheta =       0 \the\XCot@fam "E77C \relax
  \Umathchardef\msansvarkappa =       0 \the\XCot@fam "E77D \relax
  \Umathchardef\msansvarphi =         0 \the\XCot@fam "E77E \relax
  \Umathchardef\msansvarrho =         0 \the\XCot@fam "E77F \relax
  \Umathchardef\msansvarpi =          0 \the\XCot@fam "E780 \relax
  \Umathchardef\mitsansAlpha =        0 \the\XCot@fam "E791 \relax
  \Umathchardef\mitsansBeta =         0 \the\XCot@fam "E792 \relax
  \Umathchardef\mitsansGamma =        0 \the\XCot@fam "E793 \relax
  \Umathchardef\mitsansDelta =        0 \the\XCot@fam "E794 \relax
  \Umathchardef\mitsansEpsilon =      0 \the\XCot@fam "E795 \relax
  \Umathchardef\mitsansZeta =         0 \the\XCot@fam "E796 \relax
  \Umathchardef\mitsansEta =          0 \the\XCot@fam "E797 \relax
  \Umathchardef\mitsansTheta =        0 \the\XCot@fam "E798 \relax
  \Umathchardef\mitsansIota =         0 \the\XCot@fam "E799 \relax
  \Umathchardef\mitsansKappa =        0 \the\XCot@fam "E79A \relax
  \Umathchardef\mitsansLambda =       0 \the\XCot@fam "E79B \relax
  \Umathchardef\mitsansMu =           0 \the\XCot@fam "E79C \relax
  \Umathchardef\mitsansNu =           0 \the\XCot@fam "E79D \relax
  \Umathchardef\mitsansXi =           0 \the\XCot@fam "E79E \relax
  \Umathchardef\mitsansOmicron =      0 \the\XCot@fam "E79F \relax
  \Umathchardef\mitsansPi =           0 \the\XCot@fam "E7A0 \relax
  \Umathchardef\mitsansRho =          0 \the\XCot@fam "E7A1 \relax
  \Umathchardef\mitsansvarTheta =     0 \the\XCot@fam "E7A2 \relax
  \Umathchardef\mitsansSigma =        0 \the\XCot@fam "E7A3 \relax
  \Umathchardef\mitsansTau =          0 \the\XCot@fam "E7A4 \relax
  \Umathchardef\mitsansUpsilon =      0 \the\XCot@fam "E7A5 \relax
  \Umathchardef\mitsansPhi =          0 \the\XCot@fam "E7A6 \relax
  \Umathchardef\mitsansChi =          0 \the\XCot@fam "E7A7 \relax
  \Umathchardef\mitsansPsi =          0 \the\XCot@fam "E7A8 \relax
  \Umathchardef\mitsansOmega =        0 \the\XCot@fam "E7A9 \relax
  \Umathchardef\mitsansnabla =        0 \the\XCot@fam "E7AA \relax
  \Umathchardef\mitsansalpha =        0 \the\XCot@fam "E7B1 \relax
  \Umathchardef\mitsansbeta  =        0 \the\XCot@fam "E7B2 \relax
  \Umathchardef\mitsansgamma =        0 \the\XCot@fam "E7B3 \relax
  \Umathchardef\mitsansdelta =        0 \the\XCot@fam "E7B4 \relax
  \Umathchardef\mitsansvarepsilon =   0 \the\XCot@fam "E7B5 \relax
  \Umathchardef\mitsanszeta =         0 \the\XCot@fam "E7B6 \relax
  \Umathchardef\mitsanseta =          0 \the\XCot@fam "E7B7 \relax
  \Umathchardef\mitsanstheta =        0 \the\XCot@fam "E7B8 \relax
  \Umathchardef\mitsansiota =         0 \the\XCot@fam "E7B9 \relax
  \Umathchardef\mitsanskappa =        0 \the\XCot@fam "E7BA \relax
  \Umathchardef\mitsanslambda =       0 \the\XCot@fam "E7BB \relax
  \Umathchardef\mitsansmu =           0 \the\XCot@fam "E7BC \relax
  \Umathchardef\mitsansnu =           0 \the\XCot@fam "E7BD \relax
  \Umathchardef\mitsansxi =           0 \the\XCot@fam "E7BE \relax
  \Umathchardef\mitsansomicron =      0 \the\XCot@fam "E7BF \relax
  \Umathchardef\mitsanspi =           0 \the\XCot@fam "E7C0 \relax
  \Umathchardef\mitsansrho =          0 \the\XCot@fam "E7C1 \relax
  \Umathchardef\mitsansvarsigma =     0 \the\XCot@fam "E7C2 \relax
  \Umathchardef\mitsanssigma =        0 \the\XCot@fam "E7C3 \relax
  \Umathchardef\mitsanstau =          0 \the\XCot@fam "E7C4 \relax
  \Umathchardef\mitsansupsilon =      0 \the\XCot@fam "E7C5 \relax
  \Umathchardef\mitsansphi =          0 \the\XCot@fam "E7C6 \relax
  \Umathchardef\mitsanschi =          0 \the\XCot@fam "E7C7 \relax
  \Umathchardef\mitsanspsi =          0 \the\XCot@fam "E7C8 \relax
  \Umathchardef\mitsansomega =        0 \the\XCot@fam "E7C9 \relax
  \Umathchardef\mitsanspartial =      0 \the\XCot@fam "E7CA \relax
  \Umathchardef\mitsansepsilon =      0 \the\XCot@fam "E7CB \relax
  \Umathchardef\mitsansvartheta =     0 \the\XCot@fam "E7CC \relax
  \Umathchardef\mitsansvarkappa =     0 \the\XCot@fam "E7CD \relax
  \Umathchardef\mitsansvarphi =       0 \the\XCot@fam "E7CE \relax
  \Umathchardef\mitsansvarrho =       0 \the\XCot@fam "E7CF \relax
  \Umathchardef\mitsansvarpi =        0 \the\XCot@fam "E7D0 \relax
  \ifXCot@lum \else
  % 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
     \protected\def\centerdot{\vysmblksquare}%
     \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}%
    }%
  % 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}%
    }%
  \fi
}

\endinput
