[Tex/LaTex] TeX (LuaTeX, XeTeX, fontspec) support for OpenType variable fonts

fontspecluatexopentypexetex

Is anyone working on implementing support for the new OpenType variable fonts in any TeX/LaTeX implementation like XeTeX or LuaTeX? Will fontspec support accessing the new tables?

Best Answer

It is supported in luatex now(version 1.13.0):

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\defaultfontfeatures{RawFeature={+axis={wght=100}}}
\setmainfont[
    ItalicFont=SourceSansVariable-Italic.otf,
    BoldFont=SourceSansVariable-Roman.otf,
    BoldItalicFont=SourceSansVariable-Italic.otf,
    BoldFeatures={RawFeature={+axis={wght=900}}},
    BoldItalicFeatures={RawFeature={+axis={wght=900}}}
]{SourceSansVariable-Roman.otf}
\begin{document}
\par the quick brown fox jumps over the lazy dog.
\par\textit{the quick brown fox jumps over the lazy dog.}
\par\textbf{the quick brown fox jumps over the lazy dog.}
\par\textbf{\textit{the quick brown fox jumps over the lazy dog.}}
\end{document} 

enter image description here

It works pretty well in most of cases, but when the font width is changed(including some of fonts that will change width according to weight), the space between some of the characters, like double quotes and ligaments(fi, fl), will become too wide(when the actual width of changed font is smaller than regular) or too narrow(when the actual width of changed font is bigger than regular).

After luaotfload(version 3.19) and LuaTeX 1.15.0(default in TeXLive 2022), variable fonts are supported in harf mode too.