I decided to investigate the OpenType features of the fonts installed in my computer by using the XeLaTeX code from the chosen answer to How do I get a list of all font features supported by current font. However, I run into some problems very soon after I started.
Running the aforementioned code on Calibri
(a Windows font) revealed 4 stylistic sets (among other features), out of which only Stylistic Set #4 seemed to affect Latin characters: it replaces the default two-story g
in upright characters with a singe-story alternative, and does the reverse in italic letters. HOWEVER, the Wikipedia article on Calibri
(https://en.wikipedia.org/wiki/Calibri) specifically mentioned Stylistic Sets #4 and #5. That was puzzling because the aforementioned XeLaTeX code did not find Stylistic Set #5. Yet, selecting said ghost Stylistic Set #5 did indeed produce the effect advertized by Wikipedia: it revealed an alternate f
in the italic form. It seems that the XeLaTeX code is not finding features that are available in the font.
On the other hand, the opposite happens with Andika New Basic
(http://software.sil.org/andika/andika-new-basic-5-500/). There the XeLaTeX code is finding as selectable a feature which is actually not present in the font: cv01-
. SIL claims that this feature corresponds to an alternate 1
figure (http://software.sil.org/wp-content/uploads/sites/19/2015/12/AndikaNewBasic-features5.5.pdf), but selecting it with CharacterVariant=1:1
has absolutely no effect on the result.
So, what is going wrong here? Is this a bug in XeTeX's ability to detect OpenType features? Or is there something wrong with the way in which the features are encoded to the font? Or is the font is engaging in "false advertising" to those programs which query its OpenType features?
Here is the XeLaTeX code I am running.
For the part about detecting features, I copied the code from the previous question-answer I mentioned above --- with a slight change in the order of the features. For the Andika New Basic
case (analogous code for Calibri):
\documentclass{article}
\usepackage{fontspec,etoolbox,expl3}
\setmainfont{Andika New Basic}
\def\fontfeatures{abvf, abvm, abvs, aalt, akhn, nalt, halt, afrc, valt, vhal, blwf, blwm, blws, case, cpsp, smcp, c2pc, c2sc, unic, cpct, cjct, cfar, clig, cswh, curs, frac, numr, dnom, ordn, sups, subs, sinf, dist, expt, falt, fwid, haln, half, hwid, hngl, hkna, hojo, init, isol, ital, jp04, jp78, jp83, jp90, jalt, tnum, lnum, onum, pnum, ljmo, lfbd, ltra, ltrm, locl, mset, mgrk, medi, med2, nlck, nukt, opbd, size, ornm, pcap, pref, pres, psts, pstf, palt, vpal, pkna, pwid, qwid, rand, rkrf, rphf, rlig, rtbd, rtla, rtlm, ruby, smpl, liga, dlig, hlig, zero, cv01-, cv99, hist, salt, ss01, ss02, ss03, ss04, ss05, ss06, ss07, ss08, ss09, ss10, ss11, ss12, ss13, ss14, ss15, ss16, ss17, ss18, ss19, ss20, swsh, fina, fin2, fin3, twid, titl, trad, tnam, tjmo, vatu, vert, vrt2, vkna, vkrn, vjmo, ccmp, kern, mark, mkmk, calt}
% see http://en.wikipedia.org/wiki/OpenType_feature_tag_list#OpenType_Typographic_Features for their list
\ExplSyntaxOn
\newcommand\listfontfeatures{%
\renewcommand*{\do}[1]{
\fontspec_if_feature:nTF {##1}{##1,\ }{}
}
\expandafter\docsvlist\expandafter{\fontfeatures}
}
\ExplSyntaxOff
\begin{document}
\listfontfeatures
\end{document}
Now for the testing part of the code. For the Andika New Basic
MINIMAL code:
\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures[\rmfamily]{Scale=1}
\defaultfontfeatures+{Scale=MatchLowercase}
\defaultfontfeatures+{Ligatures=TeX}
\setmainfont{Andika New Basic}
\newcommand{\txt}{páck my bóx with fíve dozéñ liqüor júgs, \ae, \oe, \ss.}
\newcommand{\txtital}{{\itshape\txt}}
\newcommand{\numb}{¡ j i I l L | 1234567890 O o}
\newcommand{\CharVar}[2]{{\addfontfeature{CharacterVariant=#1}}#2 {\tiny(CharacterVariant = #1)}}
\newcommand{\StylSet}[2]{{\addfontfeature{StylisticSet=#1}#2 {\tiny(Stylistic Set = #1)}}}
\newcommand{\grup}[1]{%
\noindent#1\\%
\CharVar{1:0}{#1}\\%
\CharVar{1:1}{#1}\\%
}
\begin{document}
\pagestyle{empty}
\grup{\txt}
\grup{\numb}
\end{document}
And I do not get the 1
variant that I am supposed to get, as the following screenshot shows:
The Calibri
code is exactly the same, except that (1) I change the font line to read \setmainfont{Calibri}
and (2) I replace the definition of my \grup
command (for this MINIMAL example) as follows:
\newcommand{\grup}[1]{%
\noindent#1\\%
\StylSet{4}{#1}\\%
\StylSet{5}{#1}\\%
}
and test as follows:
\begin{document}
\pagestyle{empty}
\grup{\txt}
\grup{\txtital}
\end{document}
I do get an error message in the console warning that Variant=5 (ss05) is not available
when I run the Calibri
code. And nonetheless I get the italic f
replacement, as the following screenshot shows:
Hopefully people can reproduce the puzzling results I am getting.
otfinfo -f
say about the fonts?Andika New Basic
:CharacterVariant=1:1
is the default (1 has a base),CharacterVariant=1:0
gives the other variant (without a base) and selecting it works fine for me.