4

I'm using the Junicode typeface with the fontspec package, and I've set OldStyle numerals as the default. The OS numerals work fine, but if I try to switch to lining numbers in the middle of the text, they won't print, and instead LaTeX defaults to oldstyle. I get the following warning message:

Package fontspec Warning: OpenType feature 'Numbers=Uppercase' (lnum) not available for font 'Junicode' with script 'CustomDefault' and language 'Default'.

However, according to Junicode's documentation, it does have both lining numbers and oldstyle. So I'm not sure why LaTeX can't find it.

Here's a MWE:

\documentclass[12pt]{article}

\usepackage{fontspec}
\setmainfont{Junicode}[Numbers=OldStyle]

\begin{document}

123456789

\liningnums{123456789}

\addfontfeature{Numbers=Lining} 123456789

\end{document}

Which in prints the following:

Numbers printed.

How can I switch to lining numbers with Junicode and fontespec? I'm using LuaLaTeX, by the way.

| improve this question | | | | |
3

Junicode has no font feature for lining numbers (lnum), they are the default. There is only a feature for old style numbers (onum), which you have to remove in order to get lining numbers (if old style numbers is the default). If you want to use \liningnums you have to patch that too:

\documentclass[12pt]{article}

\usepackage{fontspec}
\setmainfont{Junicode}[Numbers=OldStyle]

\RenewDocumentCommand \liningnums {m}
{
  { \addfontfeature{RawFeature=-onum} #1 }
}

\begin{document}

123456789

\liningnums{123456789}

\addfontfeature{RawFeature=-onum} 123456789

\end{document}

enter image description here

| improve this answer | | | | |
  • Wow, thanks. A bit silly that \liningnums does not consider this but it makes sense. – johnymm Feb 6 '19 at 16:18
  • What's the difference between \renewcommand and \RenewDocumentCommand ? It's the first time I'm seeing it.... – johnymm Feb 6 '19 at 20:44
  • 3
    @johnymm, It’s part of the LaTeX3 code base, see e.g. the xparse package. – Kess Vargavind Feb 6 '19 at 21:00
7

You can remove the oldstyle feature with ..Off or ..Reset

\documentclass[12pt]{article}

\usepackage{fontspec}
\setmainfont{Junicode}[Numbers=OldStyle]

\begin{document}

123456789

\addfontfeature{Numbers=OldStyleOff} 123456789

\addfontfeature{Numbers=OldStyleReset} 123456789
\end{document}

enter image description here

| improve this answer | | | | |
  • Even better! No fiddling around with RawFeature – DG' Feb 6 '19 at 8:43
  • 2
    Hmmmmm although this is kind of a font bug I guess \liningnums should do what it can to remove the +onum feature EVEN IF there is no lnum. So I should improve things a bit... – Will Robertson Feb 6 '19 at 9:10
  • 2
    @WillRobertson yes, I was just considering to add an issue about this ;-). Why does the warning speak about a CustomDefault script? – Ulrike Fischer Feb 6 '19 at 9:13
  • 1
    Please do or I’ll forget! (Was busy with work tonight.) oh, I need to improve the messaging of the CustomDefault thing. I was trying to tidy up all the code around Script selection and this essentially means “try LATN if not try DFLT”. It shouldn’t be appearing in the messages though ... – Will Robertson Feb 6 '19 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.