Makie will not use `texfont()`

I am having a strange problem with using LaTeX font for the axis and labels in Makie. In GLMakie@0.7.0, the classic method of setting font=texfont() works without issue. I can not get the axes and labels to use the same font in later versions (I am comparing to 0.8.2, for specificity). I can’t get v0.8.2 to use any font other than the default seen below, even swapping out the texfont() for “New Computer Modern” or the full path on my system to the ttf file.

using GLMakie, MathTeXEngine

#=
	Works with GLMakie@0.7.0
=#
fig = Figure(font = texfont())
ga = fig[1,1] = GridLayout()
axs = [ Axis(ga[1,1], ylabel="Label"), Axis(ga[2,1], xlabel=L"$ t $ [ms]", ylabel=L"Another Label $x$")]	
save("./old_method.png",fig)
#=
	Adapting for GLMakie@0.8.2
=#
fig = Figure(fonts = (; regular = texfont(), bold = texfont()))
ga = fig[1,1] = GridLayout()
axs = [ Axis(ga[1,1], ylabel="Label"), Axis(ga[2,1], xlabel=L"$ t $ [ms]", ylabel=L"Another Label $x$")]
save("./new_method.png",fig)

old_method.png:
old_method
new_method.png:
new_method

I’ve tested this on multiple machines and can not get the new method to present the axes and ticks with the texfont() like the old method (pre-Makie 0.19’s font to fonts change). Wondering if anyone has figured out how to do so.

The following worked for me:
Makie.update_theme!(fonts = (regular = texfont(), bold = texfont(:bold), italic = texfont(:italic)))

I can confirm that passing fonts in the figure does not work, but I’m not sure why. Will look into it.

1 Like

Thank you very much, I would never have thought to set the fonts by calling Makie.update_theme!. Even from the docs for theming and for fonts, it’s not clear why this should be necessary – the fonts example seems to work for them (in my case, only the xlabel font is changed by the Figure-level fonts).

Agreed - it seems like a bug to me, but I’m not 100% sure why this happens.

Actually it seems that the docs example is also broken, because the labels are not “Dejavu”…