GeoMakie: Could not find font regular, using TeX Gyre Heros Makie

I have a question about the fonts in GeoMakie.jl. When I run the following sample code, I get the error “Warning: Could not find font regular, using TeX Gyre Heros Makie”.
It seems that this error occurs at the timing when GeoAxis is called.
Is there any way to avoid this warning?

using GeoMakie, CairoMakie

lons = -180:180
lats = -90:90
field = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats]

fig = Figure()
ax = GeoAxis(fig[1,1])
surface!(ax, lons, lats, field; shading = false)
save("surf_example.png", fig; px_per_unit=2)
1 Like

font = :regular is the default in Makie and that is usually translated to TeX Gyre Heros Makie (unless overridden). So that message is kind of surprising, it looks almost like font = "regular" was passed instead

I debugged this at some point, but it’s a small bug (geomakie didn’t update the use of makie internal apis for fonts), but there was a problem with creating a clean fix… Will need to revisit to see what the problem was.

1 Like

GeoMakie calls the internal function layout_text explicitly here:

We’ve been kind of deprecating layout_text(fontname, fonts, ...), and instead all makie internal functions call now layout_text(actual_font, unused),
So in the function, we need to either call to_font(font, fonts) here, which would make it work for GeoMakie, but would stop working for internal functions, or we remove fonts from the arguments, and create 2 overloads for final resolved fonts and for the font, fonts signature. A simple fix would be to call layout_text with a resolved font in GeoMakie, but that would just perpetuate this unclean use of layout_text.
I think I couldn’t decide what to do quickly enough and then run out of time to fix this nicely.

1 Like

Thanks for the explanation. I understand the current situation.