6

I am interested in using the XCharter font with oldstyle numerals and its 'alternate 1'.

Using pdftex, this is simply achieved as

\documentclass{article}
\usepackage[osf]{XCharter}
\usepackage[T1]{fontenc}

\begin{document}
    With pdftex: 123456789
\end{document} 

pdftex example of xcharter oldstyle figures

However, while using Luatex to compile the document, it is necessary to load the font using the package fontspec,

\documentclass{article}
\usepackage{fontspec}
\setmainfont{XCharter}[Numbers=OldStyle]

\begin{document}
    With luatex (and fontspec): 123456789
\end{document}

luatex example of xcharter oldstyle figures

How does one obtain the 'alternate 1' with oldstyle numerals using XCharter with Luatex?

1 Answers1

5

No feature is defined to use the alternate, but you can add one this way:

\documentclass{article}
\usepackage{fontspec}
\directlua{
  fonts.handlers.otf.addfeature{
    name = "salt",
    type = "alternate",
    data =
    {
      ["one.oldstyle"] = "one.Alt.oldstyle",
    },
  }
}
\setmainfont{XCharter}[Numbers=OldStyle,RawFeature=+salt]
\begin{document}
1234567890
\end{document}
Thérèse
  • 12,679