[luatex] Picking defaults for axes on variable fonts

Sergio Callegari sergio.callegari at unibo.it
Fri Apr 23 09:22:49 CEST 2021


Hi,

I have noticed that luatex now supports variable fonts and I've started 
experimenting. I am asking a question here but I am unsure if it is 
actually tied to luatex or luaotfload or maybe fontspec. In case, please 
be so kind to address me to the correct forum.

I have noticed that luatex may get very unhappy unless you explicitly 
set values for the axes.  For instance see the comments on 
https://tex.stackexchange.com/questions/355104/tex-luatex-xetex-fontspec-support-for-opentype-variable-fonts.

If you do

\documentclass[a4paper,12pt]{article}
\usepackage{fontspec}
\setmainfont{Source Serif 4 Variable}
\begin{document}
The quick brown fox jumps over the lazy dog.
\end{document}

then this fails with

  error:  (file .fonts/source-serif-4.004/VAR/SourceSerif4Variab
le-Roman.otf) (cff): Type2 Charstring Parser: subroutine called but no 
subrouti
ne found
!  ==> Fatal error occurred, no output PDF file produced!

To make the code work you need to add a

\defaultfontfeatures{RawFeature={+axis={wght=100}}}

Is this expected?

Shouldn't the font selection mechanism be able to determine a suitable 
weight for the font if it is not specified? If I am correct the font 
fvar table should be able to provide a defaultValue for each axis.

Why does this happen with the wght axis, but not for the opsz axis?

Thanks for considering this matter,

Best,

Sergio





More information about the luatex mailing list.