Making the font bold or italic in Makie.jl

How can you make your font either bold or italic in Makie?

I do not want the Latex font, just good old bold or italic “Arial” font.

Thank you.

Just font = "Arial bold" for example. Or you can pass a path to a font file if you don’t have it installed in one of the system typical folders. You don’t have to spell the name out exactly for more complex font names.

Thanks @jules for prompt response. font = "Arial bold" for some reason does not seem to work. I’ve tried with multiple other fonds and they all do not work. Would passing a path to a font file the best work around this?

Where are those font files located on your system? Maybe this PR would help because I just realized that a common font folder on Windows was missing from the places where we look by default https://github.com/JuliaGraphics/FreeTypeAbstraction.jl/pull/62

And passing a path can be a good option if you bundle a specific font in a repository and you want your plots to work on someone else’s system, who might not have it installed.

I see… thank you for the info. I actually use macOS, and I still haven’t been able to figure this out.

In my system the path to arial bold is: /System/Library/Fonts/SupplementalArial Bold.ttf/ I wonder why it is not working in Makie. I am not in my computer now so I cannot try but you could try that path.

Can you post the path where on your system Arial is located? Could be that it’s not included in the default path list in FreeTypeAbstraction https://github.com/JuliaGraphics/FreeTypeAbstraction.jl/blob/master/src/findfonts.jl#L4-L6

/System/Library/Fonts/ is also not in there, maybe it should be added

Yeah that seems like it. Arial font is located here: "/System/Library/Fonts/Supplemental/Arial Bold Italic.ttf"

Aha seems like a new Catalina thing, we can add the new folder

https://github.com/JuliaGraphics/FreeTypeAbstraction.jl/pull/63 latest FreeTypeAbstraction should pick up your Arial, can you update and check?

yeah it works now!

1 Like