I’m using the Linux Libertine font and have old style numbers enabled.
However, in a certain context I want to use lining figures instead. Normally I should be able to switch using \addfontfeature but this doesn’t work. MWE:
\documentclass{minimal}
\usepackage{fontspec}
\setmainfont[Numbers=OldStyle]{Linux Libertine}
\begin{document}
C++0x
C++{\addfontfeature{Numbers=Lining}0}x
{\fontspec{Linux Libertine}C++0x}
\end{document}
The output looks like this:
C++ox
C++ox
C++0x
However, the second line should look like the third, not like the first. Setting other font features (i.e. slashed zero) doesn’t work either.
Additionally, if I use another font (e.g. Hoefler Text) then the output is as expected.
Does somebody have an idea what’s going on here?
\fontspecexample was just to illustrate that the lining figure actually works when this font is loaded directly. Anyway, thanks for the info that this is potentially a bug. I guess I’ll use your workaround then. – Konrad Rudolph Feb 13 '11 at 14:51\newfontface(or family) solution is actually preferable to the\addfontfeatureroute anyway. But your example should work as advertised. – Alan Munn Feb 13 '11 at 15:18\addfontfeatureyou add both open type features to the feature list and the result depends mostly on how they are implemented in the font. See also this post of Jonathan Kew: http://tug.org/mailman/htdig/xetex/2008-June/010015.html. So if you want to use "conflicting" features you shouldn't use\addfontfeature. – Ulrike Fischer Feb 13 '11 at 15:22\addfontfeatureshas the advantage of working regardless of the parent font family. In fact, this is an issue in my case – now I need to redefine the relevant variable for each font family (roman, sans and mono) which makes this whole thing needlessly complicated. – Konrad Rudolph Feb 13 '11 at 15:25\addfontfeatureis a bit meaningless. I wouldn’t necessarily call it a “bug” but at least a missing feature. – Konrad Rudolph Feb 13 '11 at 15:28\addfontfeaturecan't simply add something to the featurelist, it would have to go through the list and actively remove some of the features. That's not easy to implement. – Ulrike Fischer Feb 13 '11 at 15:35\fontspec_define_fontfeature_optioncould be modified to set and unset them automatically? – Alan Munn Feb 13 '11 at 21:24\removefontfeaturesor improvements to\addfontfeatureswill solve the actual problem. But the general problem is that the font type (rm, tt, sans ...) is not independant from the font family. There can be only onermfamilyfont. This is e.g. also a problem when more than one script is involved. You can't declare rm + tt fonts for both scripts. Polyglossia has some commands to adress this problem (\rmfamilytype,familytype) but doesn't do very much with them. – Ulrike Fischer Feb 14 '11 at 09:13