Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

\addfontfeature{Numbers=OldStyle}

96 views
Skip to first unread message

Bob Tennent

unread,
Nov 4, 2012, 10:44:45 PM11/4/12
to
In the following, the line with an exclamation mark should be in
oldstyle figures:

\documentclass[12pt]{article}
\usepackage{fontspec}
\renewcommand*\oldstylenums[1]{{\addfontfeature{Numbers=OldStyle}#1}}
\begin{document}\Large
{\fontspec[Numbers=Lining]{LinLibertine_R.otf} 1234567890

\oldstylenums{1234567890} !}

{\fontspec[Numbers=OldStyle]{LinLibertine_R.otf} 1234567890 }
\end{document}

Can anyone explain why it isn't? The same example works with Biolinum,
a companion sans font.

Bob T.

Bob Tennent

unread,
Nov 4, 2012, 11:48:58 PM11/4/12
to
This is a known issue:

http://tex.stackexchange.com/questions/10986/
lining-numbers-not-working-in-certain-fonts

The following works:

\renewcommand{\oldstylenums}[1]{{%
\fontspec[ Numbers = {\LinuxLibertineO@figurealign,OldStyle},
UprightFont = *_R,
ItalicFont = *_RI,
BoldFont = *_\LinuxLibertineO@boldstyle,
BoldItalicFont = *_\LinuxLibertineO@boldstyle I]{LinLibertine}
#1
}}

There's probably a more elegant/efficient solution using newfontfamily
or newfontface but the documentation is very poor and I can't figure out
how to do that.

Bob T.

Ulrike Fischer

unread,
Nov 5, 2012, 8:01:04 AM11/5/12
to
You could try something like this:

\documentclass[12pt]{article}
\usepackage{fontspec,l3regex}

\makeatletter
\ExplSyntaxOn
\cs_generate_variant:Nn\regex_replace_all:nnN{n n o}

\newcommand\removefontfeature[1]{%
\regex_replace_all:nno{#1}{}{\csname
zf@family@options\f@family\endcsname}}

\ExplSyntaxOff
\makeatother



\renewcommand*\oldstylenums[1]{{%
\removefontfeature{Numbers=Lining}%
\removefontfeature{Numbers=Uppercase}%
\addfontfeature{Numbers=OldStyle}#1}}


\begin{document}\Large
{\fontspec[Numbers=Lining]{LinLibertine_R.otf} 1234567890

\oldstylenums{1234567890} !}

{\fontspec[Numbers=OldStyle]{LinLibertine_R.otf} 1234567890 }
\end{document}

--
Ulrike Fischer
http://www.troubleshooting-tex.de/

Bob Tennent

unread,
Nov 5, 2012, 8:22:36 AM11/5/12
to
On Mon, 5 Nov 2012 14:01:04 +0100, Ulrike Fischer wrote:
>> > \documentclass[12pt]{article}
>> > \usepackage{fontspec}
>> > \renewcommand*\oldstylenums[1]{{\addfontfeature{Numbers=OldStyle}#1}}
>> > \begin{document}\Large
>> > {\fontspec[Numbers=Lining]{LinLibertine_R.otf} 1234567890
>> >
>> > \oldstylenums{1234567890} !}
>> >
>> > {\fontspec[Numbers=OldStyle]{LinLibertine_R.otf} 1234567890 }
>> > \end{document}
>> >
>> > Can anyone explain why it isn't? The same example works with Biolinum,
>> > a companion sans font.
>>
>> This is a known issue:
>>
>> http://tex.stackexchange.com/questions/10986/
>> lining-numbers-not-working-in-certain-fonts
>>
> You could try something like this:
>
> \documentclass[12pt]{article}
> \usepackage{fontspec,l3regex}
>
> \makeatletter
> \ExplSyntaxOn
> \cs_generate_variant:Nn\regex_replace_all:nnN{n n o}
>
> \newcommand\removefontfeature[1]{%
> \regex_replace_all:nno{#1}{}{\csname
> zf@family@options\f@family\endcsname}}
>
> \ExplSyntaxOff
> \makeatother
>
>
>
> \renewcommand*\oldstylenums[1]{{%
> \removefontfeature{Numbers=Lining}%
> \removefontfeature{Numbers=Uppercase}%
> \addfontfeature{Numbers=OldStyle}#1}}

Thanks but I really have no incentive now that I have working code.
It's fontspec's problem, not mine. And their most urgent issue is to
fix the documentation, which actually uses an example much like this to
illustrate addfontfeature and says nothing about its known unreliabilty.
On a scale of 1 to 7, this deserves a -5.

Bob T.


Ulrike Fischer

unread,
Nov 5, 2012, 9:06:52 AM11/5/12
to
Am Mon, 5 Nov 2012 13:22:36 +0000 (UTC) schrieb Bob Tennent:


> Thanks but I really have no incentive now that I have working code.
> It's fontspec's problem, not mine. And their most urgent issue is to
> fix the documentation, which actually uses an example much like this to
> illustrate addfontfeature and says nothing about its known unreliabilty.
> On a scale of 1 to 7, this deserves a -5.

The author of fontspec is not an anonymous "they" but a person with
a name. If you think that something is missing in the documentation
I suggest that *you* write *him* a mail and ask him to clarify the
point. I already spent some time to try to help you to solve your
problem. I will not spent more to forward your complains.

Bob Tennent

unread,
Nov 5, 2012, 9:29:44 AM11/5/12
to
I didn't ask you to. I'd already posted an "issue" on their bug
tracker. I regret that my rant was misinterpreted.

Bob T.
0 new messages