Wrong font style being selected in Makie

Hello,

While plotting using ‘Makie.jl’, I am passing the command titlefont = "Arial" in Axis() command to change the title font to Arial, and as expected, I get to see Arial font being used. But when I pass titlefont = "Arial Bold", instead of a bold-weighted regular Arial, the command is choosing the ‘Arial Rounded MT Bold’ font, as shown below:

image

I pass the command set_theme!(Theme(font = "Arial")) at the beginning of the code, and thus you see regular Arial being used for tick labels. I’ve checked the "C:\Windows\Fonts\Arial" folder in my machine and ‘Arial Bold’ is indeed installed.

Can someone help me out?

Which version are you using?

The way you set fonts has been changed recently: [ANN] Makie.jl 0.19 - #2 by jules

1 Like

The version for CairoMakie and Makie are [13f3f980] CairoMakie v0.8.13 and [ee78f7c6] Makie v0.17.13 respectively.

I guess the change doesn’t apply to the version I am currently using. So, is there a way around?

Also, I am defining the weight of the font in the Axis attributes in the following way:

ax = Axis(fig[i, j], title = plot_title, ... titlefont = "Arial Bold")

Fonts are chosen by best match of the parts of the name, so if Arial Bold is not picked but Arial Rounded MT Bold is, that suggests that Arial Bold was not in the list of choices. Why that is, I don’t know, fonts are a complicated topic and there can be many things that go wrong.

What you could try is passing the complete path to the font instead of Arial Bold, that way you circumvent the font search algorithm.

Also, I think Makie currently can’t deal with fonts where one font file contains multiple styles. There’s an issue about that open in the repository already.

1 Like

Okay, I understand the issue…

I’ll try using the full path. Is this the correct way?

ax = Axis(fig[i, j], ... titlefont = "<U+202A>C:/Windows/Fonts/arialbd.ttf")

What’s <U+202A>? Other than that, looks correct.

1 Like

Sorry <U+202A> was a copying error. The address is C:/Windows/Fonts/arialbd.ttf. Thank you for the solution. :slight_smile: