# Makie font variants?

**URL:** <https://discourse.julialang.org/t/makie-font-variants/132818>\
**Category:** Visualization\
**Created:** [October 2, 2025, 8:12am UTC](https://discourse.julialang.org/t/makie-font-variants/132818 "2025-10-02T08:12:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [October 2, 2025, 8:12am UTC](https://discourse.julialang.org/t/makie-font-variants/132818/1 "2025-10-02T08:12:42Z")

</div>

I’m trying to find out how to specify font variants. The following attempt fails:

```julia
using CairoMakie

fig = Figure(; fonts = (
    regular = "Baskerville",
    italic = "Baskerville Italic",
))

ax = Axis(fig[1, 1])
text!(ax, (0.5,0.5); text = rich("italic?", font=:italic))
fig

```

This does change the font, presumably to Baskerville, but it’s not italic. Mac’s “FontBook” app shows that Baskerville does have an italic variant.

The file `/System/Library/Fonts/Supplemental/Baskerville.ttc` exists. That’s the only `Baskerville*` font file in the directory.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 2, 2025, 10:04am UTC](https://discourse.julialang.org/t/makie-font-variants/132818/2 "2025-10-02T10:04:57Z")

</div>

`ttc` fonts contain multiple faces in one file. However, the font finding machinery is currently not set up to handle this, the assumption is one face per file and for collections, I think the first face’s info is being used. So it simply does not see the other variants. There are websites or tools which allow you to convert ttc files to multiple ttf or otf ones, though.

The capability to use multiple variants could in principle be added to FreeType/FreeTypeAbstraction, too.

---

<div class="post-metadata">

**Author:** ![TZ.Neumann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tz.neumann/32/34438_2.png) [@TZ.Neumann](https://discourse.julialang.org/u/TZ.Neumann)\
**Post date:** [October 2, 2025, 12:17pm UTC](https://discourse.julialang.org/t/makie-font-variants/132818/3 "2025-10-02T12:17:13Z")

</div>

you could try

```julia
using CairoMakie
using FreeTypeAbstraction

font_name = "Baskerville"
font_dir = last(FreeTypeAbstraction.valid_fontpaths)
italic_path = joinpath(font_dir, "$(replace(font_name, " " => ""))-Italic.ttf")

fig = Figure(fonts=(
    regular=font_name,
    italic=italic_path
))

text!(Axis(fig[1, 1]), (0.5, 0.5); text=rich("this is italic?", font=:italic))
fig

```

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [October 2, 2025, 2:21pm UTC](https://discourse.julialang.org/t/makie-font-variants/132818/4 "2025-10-02T14:21:32Z")

</div>

> [@TZ.Neumann](#):
>
> ```julia-auto
> italic_path = joinpath(font_dir, "$(replace(font_name, " " => ""))-Italic.ttf")
> 
> ```

Thanks, but as I said, there is only one file: `/System/Library/Fonts/Supplemental/Baskerville.ttc`. There is no `Baskerville-Italic.ttf`. There is no `Baskerville...` file in the directory except for the single `ttc` file.

I know almost nothing about how fonts are arranged, but I notice that it’s not a `ttf` file. It’s a `ttc` file. That must mean that this single file contains all the variants.

What we don’t know, therefore, is how to select one variant within the file.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 2, 2025, 3:39pm UTC](https://discourse.julialang.org/t/makie-font-variants/132818/5 "2025-10-02T15:39:53Z")

</div>

I explained above that it’s currently not possible

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [October 2, 2025, 5:09pm UTC](https://discourse.julialang.org/t/makie-font-variants/132818/6 "2025-10-02T17:09:12Z")

</div>

Sorry I missed your message!

So, inspired by this discussion, I explored how to extract `ttf`s from a `ttc` file and found a solution: First install “fonttools” (`brew install fonttools` if you use Homebrew) and then

```julia
using CairoMakie
using FreeTypeAbstraction

font_name = "Baskerville"
font_dir = last(FreeTypeAbstraction.valid_fontpaths)
ttc = joinpath(font_dir, font_name * ".ttc")
@show ttc
run(`ttx -y 2 -o tmp.ttx $(ttc)`) # extract font 2
run(`ttx tmp.ttx`) # convert ttx to ttf

fig = Figure(fonts=(
    regular=font_name,
    italic="./tmp.ttf"
))

text!(Axis(fig[1, 1]), (0.5, 0.5); text=rich("this is italic?", font=:italic))
fig

```

The italic variant turned out to be number 2 in the collection (which is what a `ttc` is) so that’s what `-y 2` means.

I found this by trial and error, but there seem to be systematic methods to find that out, but those methods seem to be very complicated. There must be a simple way to query a `ttc` file, but the above is fine as a workaround.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 2, 2025, 5:21pm UTC](https://discourse.julialang.org/t/makie-font-variants/132818/7 "2025-10-02T17:21:00Z")

</div>

As far as I know FreeType already contains machinery for this, we just don’t use it as I think ttcs are mostly a thing on Mac and the main maintainer of that font stack is on Linux.

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [October 2, 2025, 5:25pm UTC](https://discourse.julialang.org/t/makie-font-variants/132818/8 "2025-10-02T17:25:32Z")

</div>

> [@jules](#):
>
> `ttc` fonts contain multiple faces in one file. However, the font finding machinery is currently not set up to handle this, the assumption is one face per file and for collections,

I found there are more `tcc` files than `ttf` files under `/System/Library/Fonts/` on macOS. In particular, the staple fonts like Courier, Helvetica, Palatino, and Times seem to have only `tcc`.

That means that only the 0th variant is available for these fonts from `Makie`.

If I seriously need the variants, I’ll find a set of `ttf`s and install them under my home directory or generate them from the `ttc`s. Currently I’m fine with the above workaround.

---

<div class="post-metadata">

**Author:** ![technocrat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/technocrat/32/220947_2.png) [@technocrat](https://discourse.julialang.org/u/technocrat)\
**Post date:** [October 2, 2025, 8:50pm UTC](https://discourse.julialang.org/t/makie-font-variants/132818/9 "2025-10-02T20:50:39Z")

</div>

If you need ttf, there’s a version LibreBaskerville from[Google Fonts](https://fonts.google.com) or you can get open type from [LibreBaskerville](https://github.com/impallari/Libre-Baskerville/blob/master/fonts/LibreBaskerville-Italic.otf). _Keep_ the downloaded fonts, whether or not you install them with FontBook and specify those.

---

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [October 3, 2025, 4:43am UTC](https://discourse.julialang.org/t/makie-font-variants/132818/10 "2025-10-03T04:43:18Z")

</div>

> [@jules](#):
>
> we just don’t use it as I think ttcs are mostly a thing on Mac and the main maintainer of that font stack is on Linux.

Or perhaps, the font library on Linux is already designed to hide the distinction between a collection of `ttf`s and a `ttc`? or Linux distributions always generate `ttf`s from a `ttc` on installation? See [this external Q&A thread](https://askubuntu.com/questions/1313730/what-is-the-difference-between-ttf-and-ttc-fonts-on-ubunt-20-04), which means that `ttc`s are already a standard component on Linux.

Also, a comment in [another external thread](https://graphicdesign.stackexchange.com/questions/127828/differences-and-similarities-between-ttf-and-ttc-fonts) indicates that Cambria shipped with Windows is in the `ttc` format.

This all makes sense. To present a “font family” as a single file (ttc) is more convenient than to have a set of files named like Times-Regular.ttf, Times-Italic.ttf, Times-Bold.ttf, . . .
