Hi,
I was experimenting with variable fonts in ConTeXt. While all seems to work well when using a ttf font (like Recursive_VF_1.085.ttf), I am struggling to use .otf ones, like the Source Code Pro (downloaded from https://github.com/adobe-fonts/source-code-pro/releases/tag/2.042R-u%2F1.062R-i%2F1.026R-vf ).
Minimal example:
________________________________________
\definefontfeature[myaxis][axis={weight=500}]
\definefontfamily[mainface][rm][Source Code VF]
[features={default, myaxis}]
% Works when replacing the two above lines with these
%\definefontfamily[mainface][rm][Recursive]
% [features={default, myaxis}]
\setupbodyfont[mainface]
\starttext
\mainface Hallo
\stoptext
________________________________________
The (from what I understand) relevant part of the log is:
__________________________________________________________________________
fonts > otf loading > loading '/home/florent/.local/share/fonts/SourceCodeVF-Upright.otf', hash 'sourcecodevf-upright-weight-500'
otf reader > user instance: weight=500, factors: 0.42857142857142855
otf reader > cff > unknown local call 2, bias 107, case 2 : [48 32 60 164 26 72] n=6
otf reader > cff > unknown local call 2, bias 107, case 2 : [-10 42 -33 -90 10 26] n=6
otf reader > cff > unknown local call 2, bias 107, case 2 : [176 292 -5 -14 -15 -40] n=6
otf reader > cff > unknown local call 90, bias 107, case 2 : [-94 -168 -54 -92 28 76 49 132 5 14 -2 -4] n=12
otf reader > cff > unknown local call 2, bias 107, case 2 : [26 -26 21 58 -21 -58] n=6
otf reader > cff > unknown local call 1, bias 107, case 2 : [152 270 -25 -70 -38 -102] n=6
otf reader > cff > unknown local call 1, bias 107, case 2 : [-152 266 25 70 -36 -98] n=6
otf reader > cff > unknown local call 17, bias 107, case 2 : [] n=0
otf reader > cff > unknown local call 464, bias 107, case 2 : [] n=0
otf reader > cff > unknown local call 776, bias 107, case 2 : [172 29 80] n=3
otf reader > fatal error in file '/home/florent/.local/share/fonts/SourceCodeVF-Upright.otf': /home/florent/lmtx/tex/context/base/mkxl/font-cff.lmt:1956: attempt to perform arithmetic on a nil value (field '?')
stack traceback:
/home/florent/lmtx/tex/context/base/mkiv/font-otr.lua:2350: in metamethod 'mul'
/home/florent/lmtx/tex/context/base/mkxl/font-cff.lmt:1956: in local 'a'
/home/florent/lmtx/tex/context/base/mkxl/font-cff.lmt:2508: in upvalue 'process'
/home/florent/lmtx/tex/context/base/mkxl/font-cff.lmt:2685: in upvalue 'processshape'
/home/florent/lmtx/tex/context/base/mkxl/font-cff.lmt:2834: in upvalue 'parsecharstrings'
/home/florent/lmtx/tex/context/base/mkxl/font-cff.lmt:3067: in upvalue 'readnoselect'
/home/florent/lmtx/tex/context/base/mkxl/font-cff.lmt:3279: in local 'reader'
/home/florent/lmtx/tex/context/base/mkiv/font-otr.lua:2094: in upvalue 'readtable'
/home/florent/lmtx/tex/context/base/mkiv/font-otr.lua:2203: in upvalue 'readdata'
/home/florent/lmtx/tex/context/base/mkiv/font-otr.lua:2263: in function </home/florent/lmtx/tex/context/base/mkiv/font-otr.lua:2246>
[C]: in function 'xpcall'
/home/florent/lmtx/tex/context/base/mkiv/font-otr.lua:2352: in upvalue 'loadfont'
/home/florent/lmtx/tex/context/base/mkiv/font-otr.lua:2407: in field 'loadfont'
/home/florent/lmtx/tex/context/base/mkxl/font-otl.lmt:160: in field 'load'
/home/florent/lmtx/tex/context/base/mkxl/font-otl.lmt:663: in upvalue 'otftotfm'
/home/florent/lmtx/tex/context/base/mkxl/font-otl.lmt:691: in function </home/florent/lmtx/tex/context/base/mkxl/font-otl.lmt:690>
(...tail calls...)
/home/florent/lmtx/tex/context/base/mkxl/font-def.lmt:364: in function </home/florent/lmtx/tex/context/base/mkxl/font-def.lmt:352>
(...tail calls...)
/home/florent/lmtx/tex/context/base/mkxl/font-def.lmt:467: in field 'read'
/home/florent/lmtx/tex/context/base/mkxl/font-ctx.lmt:1385: in function </home/florent/lmtx/tex/context/base/mkxl/font-ctx.lmt:1240>
(...tail calls...)
fonts > otf loading > loading failed due to read error
fonts > defining > forced type 'otf' of 'SourceCodeVF-Upright' not found
__________________________________________________________________________
Interestingly, all works well if I delete the file SourceCodeVF-Upright.otf from my font directory to force the use of SourceCodeVF-Upright.ttf instead.
Is there something wrong in my example which causes issues with the otf variant?
Cheers,
Florent