0

I'm running TeXlive 2023, fully updated, under Linux (openSuse Tumbleweed).

I'm looking into variable fonts (see here: Recursive Font, multiple axes, fontspec, texlive 2022). I downloaded a variable fonts from https://fonts.google.com/specimen/Geologica , the file name was Geologica-VariableFont_CRSV,SHRP,slnt,wght.ttf. I renamed that to Geologica-VariableFont.ttf.

I'm trying to write a line of text where each characters will be a little bit thicker than the last one. MWE:

\documentclass{article}

\usepackage{fontspec}
%\usepackage[ngerman]{babel}

\setmainfont{Geologica-VariableFont.ttf}[
 Renderer=HarfBuzz,
% ItalicFont=Geologica-VariableFont.ttf,
% BoldFont=Geologica-VariableFont.ttf,
% BoldItalicFont=Geologica-VariableFont.ttf,
% BoldFeatures={RawFeature={+axis={wght=500}}},
% ItalicFeatures={RawFeature={+axis={wght=250, slnt=-12, CRSV=1, SHRP=100}}},
% UprightFeatures={RawFeature={+axis={wght=250, SHRP=100}}},%
]

\newcommand{\Upwght}[2]{\addfontfeatures{UprightFeatures={RawFeature={+axis={SHRP=100,wght=#1}}}}#2}%

% \newcommand{\Itwght}[2]{\addfontfeatures{ItalicFeatures={RawFeature={+axis={CRSV=1,slnt=-12,SHRP=100,wght=#1}}}}#2}%


\begin{document}
%\LARGE

Hallo!

\Upwght{100}{U}%
\Upwght{120}{n}%
\Upwght{140}{g}%
\Upwght{160}{e}%
\Upwght{180}{h}%
\Upwght{200}{a}%
\Upwght{220}{l}%
\Upwght{240}{t}%
\Upwght{260}{e}%
\Upwght{280}{n}%
\Upwght{300}{e}
\Upwght{320}{R}%
\Upwght{340}{e}%
\Upwght{360}{d}%
\Upwght{380}{e}%
\Upwght{400}{n}
 \Upwght{420}{u}%
 \Upwght{440}{n}%
 \Upwght{460}{g}%
 \Upwght{480}{e}%
 \Upwght{500}{h}%
\Upwght{520}{a}%
\Upwght{540}{l}%
\Upwght{560}{t}%
\Upwght{580}{e}%
\Upwght{600}{n}%
\Upwght{620}{e}%
\Upwght{640}{r}
\Upwght{660}{F}%
\Upwght{680}{r}%
\Upwght{700}{a}%
\Upwght{750}{u}%
\Upwght{800}{e}%
\Upwght{900}{n}

\end{document}

If I comment out the last six letters, it works. But this MWE here stops with:

> Running `LaTeX' on `230715-Geologica-experimente' with ``lualatex-dev 
> -file-line-error   --synctex=1 -interaction=nonstopmode 230715-Geologica-experimente.tex'' This is LuaHBTeX, Version 1.17.0
> (TeX Live 2023)   restricted system commands enabled.
> (./230715-Geologica-experimente.tex LaTeX2e <2023-11-01> pre-release-0
> (develop 2023-8-12 branch) L3 programming layer <2023-08-11> 
> (/local/texlive/2023/texmf-dist/tex/latex-dev/base/article.cls
> Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
> (/local/texlive/2023/texmf-dist/tex/latex-dev/base/size10.clo))
> (/local/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.sty
> (/local/texlive/2023/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
> (/local/texlive/2023/texmf-dist/tex/latex/l3kernel/expl3.sty
> (/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)))
> (/local/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
> (/local/texlive/2023/texmf-dist/tex/latex-dev/base/fontenc.sty)
> (/local/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
> (./230715-Geologica-experimente.aux)
> (/local/texlive/2023/texmf-dist/tex/latex-dev/base/ts1cmr.fd)realloc():
> invalid next size
> 
> TeX Output abgebrochen (core dumped) at Sat Aug 12 14:02:43

The log contains 28 (!) blocks, here No. 1:

    Package fontspec Info: Font family 'Geologica-VariableFont.ttf(1)' created for
(fontspec)             font 'Geologica-VariableFont.ttf' with options
(fontspec)             [Ligatures=TeX,Renderer=HarfBuzz,UprightFeatures={RawFea
ture={+axis={SHRP=100,wght=100}}}].
(fontspec)              
(fontspec)              This font family consists of the following NFSS
(fontspec)             series/shapes:
(fontspec)              
(fontspec)             - 'normal' (m/n) with NFSS spec.:
(fontspec)             <->"[Geologica-VariableFont.ttf]:mode=harf;script=latn;l
anguage=dflt;+tlig;+axis={SHRP=100,wght=100};"
(fontspec)             - 'small caps'  (m/sc) with NFSS spec.: 

Then No. 2 with wght=120:

Package fontspec Info: Font family 'Geologica-VariableFont.ttf(2)' created for
(fontspec)             font 'Geologica-VariableFont.ttf' with options
(fontspec)             [Ligatures=TeX,Renderer=HarfBuzz,UprightFeatures={RawFea
ture={+axis={SHRP=100,wght=100}}},UprightFeatures={RawFeature={+axis={SHRP=100,
wght=120}}}].
(fontspec)              
(fontspec)              This font family consists of the following NFSS
(fontspec)             series/shapes:
(fontspec)              
(fontspec)             - 'normal' (m/n) with NFSS spec.:
(fontspec)             <->"[Geologica-VariableFont.ttf]:mode=harf;script=latn;l
anguage=dflt;+tlig;+axis={SHRP=100,wght=100};+axis={SHRP=100,wght=120};"
(fontspec)             - 'small caps'  (m/sc) with NFSS spec.: 

And here the end of the log file:

Package fontspec Info: Font family 'Geologica-VariableFont.ttf(28)' created
(fontspec)             for font 'Geologica-VariableFont.ttf' with options
(fontspec)             [Ligatures=TeX,Renderer=HarfBuzz,UprightFeatures={RawFea
ture={+axis={SHRP=100,wght=100}}},UprightFeatures={RawFeature={+axis={SHRP=100,
wght=120}}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=140}}},UprightFea
tures={RawFeature={+axis={SHRP=100,wght=160}}},UprightFeatures={RawFeature={+ax
is={SHRP=100,wght=180}}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=200}
}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=220}}},UprightFeatures={Ra
wFeature={+axis={SHRP=100,wght=240}}},UprightFeatures={RawFeature={+axis={SHRP=
100,wght=260}}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=280}}},Uprigh
tFeatures={RawFeature={+axis={SHRP=100,wght=300}}},UprightFeatures={RawFeature=
{+axis={SHRP=100,wght=320}}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=
340}}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=360}}},UprightFeatures
={RawFeature={+axis={SHRP=100,wght=380}}},UprightFeatures={RawFeature={+axis={S
HRP=100,wght=400}}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=420}}},Up
rightFeatures={RawFeature={+axis={SHRP=100,wght=440}}},UprightFeatures={RawFeat
ure={+axis={SHRP=100,wght=460}}},UprightFeatures={RawFeature={+axis={SHRP=100,w
ght=480}}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=500}}},UprightFeat
ures={RawFeature={+axis={SHRP=100,wght=520}}},UprightFeatures={RawFeature={+axi
s={SHRP=100,wght=540}}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=560}}
},UprightFeatures={RawFeature={+axis={SHRP=100,wght=580}}},UprightFeatures={Raw
Feature={+axis={SHRP=100,wght=600}}},UprightFeatures={RawFeature={+axis={SHRP=1
00,wght=620}}},UprightFeatures={RawFeature={+axis={SHRP=100,wght=640}}}].
(fontspec)              
(fontspec)              This font family consists of the following NFSS
(fontspec)             series/shapes:
(fontspec)              
(fontspec)             - 'normal' (m/n) with NFSS spec.:
(fontspec)             <->"[Geologica-VariableFont.ttf]:mode=harf;script=latn;l
anguage=dflt;+tlig;+axis={SHRP=100,wght=100};+axis={SHRP=100,wght=120};+axis={S
HRP=100,wght=140};+axis={SHRP=100,wght=160};+axis={SHRP=100,wght=180};+axis={SH
RP=100,wght=200};+axis={SHRP=100,wght=220};+axis={SHRP=100,wght=240};+axis={SHR
P=100,wght=260};+axis={SHRP=100,wght=280};+axis={SHRP=100,wght=300};+axis={SHRP
=100,wght=320};+axis={SHRP=100,wght=340};+axis={SHRP=100,wght=360};+axis={SHRP=
100,wght=380};+axis={SHRP=100,wght=400};+axis={SHRP=100,wght=420};+axis={SHRP=1
00,wght=440};+axis={SHRP=100,wght=460};+axis={SHRP=100,wght=480};+axis={SHRP=10
0,wght=500};+axis={SHRP=100,wght=520};+axis={SHRP=100,wght=540};+axis={SHRP=100
,wght=560};+axis={SHRP=100,wght=580};+axis={SHRP=100,wght=600};+axis={SHRP=100,
wght=620};+axis={SHRP=100,wght=640};"
(fontspec)             - 'small caps'  (m/sc) with NFSS spec.: 


Package fontspec Info: Font family 'Geologica-VariableFont.ttf(29)' created
(fontspec)             for f

If I comment out starting at the 29th letter, it works. What can I improve? I guess the culprit is my clumsy command:

\newcommand{\Upwght}[2]{\addfontfeatures{UprightFeatures={RawFeature={+axis={SHRP=100,wght=#1}}}}#2}%

pic with partial text

2
  • 1
    well I certainly would not use \addfontfeatures for this (at least not without grouping). As the name implies it adds features, in your case more and more RawFeature settings and that is not a good idea. Aug 12, 2023 at 12:36
  • 1
    Sounds like a bug to be reported to the LuaTeX developers — Knuth TeX / eTeX (and pdfTeX too?) would never call "realloc(); all memory is allocated at the start of the program (AFAIK). Aug 12, 2023 at 14:19

1 Answer 1

1

You can avoid this by replacing your \Upwght command with:

\newcommand{\Upwght}[2]{{\addfontfeatures{UprightFeatures={RawFeature={+axis={SHRP=100,wght=#1}}}}#2}}%

This adds braces around the entire command, ensuring that the new feature applies only to the argument and not the entire remaining document. This generally makes the command behave in a more intuitive way (why would it even take an argument if it applies to everything afterwards anyway?) and avoids the problem of excessively many font features piling up.

1
  • Thank you, works. What do you think about ShreevatsaR's comment that the realloc error is worth a bug report?
    – Keks Dose
    Aug 12, 2023 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .