Trouble using Arial italic font in Makie

I used to be able to use italics when using the Arial font in Makie, but for some reason, it no longer works. Below are two code snippets, one using Arial, and one using Verdana (both from the same ttf-mscorefonts-installer that provides microsoft fonts for linux):

fig = Figure(
        size = (17/2.54*72, 200.0),
        fontsize = 8,
        fonts = (; regular = "Arial", bold = "Arial bold", italic = "Arial italic"),
        figure_padding = (0.5, 5.0, 3.0, 5.0) # L, R, B, T
)

ax = Axis(fig[1,1]; xlabel = rich("Regular, ", rich("Bold, ", font = :bold), rich("Italic", font = :italic)))
lines!(ax, [0,1], [0,1])

fig

Produces:

fig = Figure(
        size = (17/2.54*72, 200.0),
        fontsize = 8,
        fonts = (; regular = "Verdana", bold = "Verdana bold", italic = "Verdana italic"),
        figure_padding = (0.5, 5.0, 3.0, 5.0) # L, R, B, T
)

ax = Axis(fig[1,1]; xlabel = rich("Regular, ", rich("Bold, ", font = :bold), rich("Italic", font = :italic)))
lines!(ax, [0,1], [0,1])

fig

Produces:

I’m not sure this is an issue with Makie or some problem with the font files, but regardless, I’d happily take any clues on how to possibly resolve the issue.

I’m on Linux Mint 22.2 Cinnamon.

Julia Version 1.11.7
Commit f2b3dbda30a (2025-09-08 12:10 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 Ă— Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_VSCODE_REPL = 1

Output of packages:

Status `~/.julia/environments/v1.11/Project.toml`
  [6e4b80f9] BenchmarkTools v1.6.3
  [13f3f980] CairoMakie v0.15.7
  [e9467ef8] GLMakie v0.13.7

What does Makie.to_font("Arial italic") print in the REPL? It probably picks up the regular font as a fallback because it can’t find the italic one. If that’s so, the question is why. Are you sure that font file is present? Is it actually called Arial italic?

1 Like

Thanks Jules, I just did that. Here are the outputs:

julia> Makie.to_font("Arial italic")
FTFont (family = Noto Sans Old Italic, style = Regular)

julia> Makie.to_font("Arial")
FTFont (family = Arial, style = Regular)

julia> Makie.to_font("Arial bold")
FTFont (family = Arial, style = Bold)

The following version of the code works:

it_font = "/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf"
fig = Figure(
        size = (17/2.54*72, 200.0),
        fontsize = 8,
        fonts = (; regular = "Arial", bold = "Arial bold", italic = it_font),
        figure_padding = (0.5, 5.0, 3.0, 5.0) # L, R, B, T
)

ax = Axis(fig[1,1]; xlabel = rich("Regular, ", rich("Bold, ", font = :bold), rich("Italic", font = :italic)))
lines!(ax, [0,1], [0,1])

fig

As best as I can tell, all the Arial subfonts are in this one same folder, so not sure what’s going wrong here. For the time being, I can manually specify the font file.

1 Like

Ah I think the issue is that Italic is part of the family name of that Noto font. And I think the font finding heuristic values matches in the family higher than in the styles, because it’s assumed you’d rather get the right family and slightly incorrect style than exact style but completely different font. However in this case you do get a completely different font as it has Italic in the name (which is unusual). I wonder how the font finding heuristic could be made more robust, it sometimes gives weird results like this but I also didn’t want to make it completely precise because it’s so annoying having to spell font names and styles exactly right.

I get

julia> Makie.to_font(it_font)
FTFont (family = Arial, style = Italic)

Edit: Ah, never mind. I don’t think I’ve ever actually used the “Noto Sans Old Italic” for anything, perhaps I could get rid of it. Not sure when or where I got it.

The heuristic has worked remarkably well up to this point for me as I’ve never even noticed there was one. I guess once it breaks down it’s somewhat non-trivial to trouble-shoot, especially if you’re not used to messing around with font stuff on the regular. To be fair, the “Makie.to_font” is listed as part of the Makie font documentation, I just didn’t quite understand it on a first go. It also was a somewhat unfortunate coincidence that “Noto Sans Old Italic” looks so similar to regular Arial that I just assumed that’s what was happening.