# Font family 'Computer Modern' not found

**URL:** <https://discourse.julialang.org/t/font-family-computer-modern-not-found/93355>\
**Category:** Visualization\
**Tags:** pyplot, plots, fonts\
**Created:** [January 22, 2023, 11:52am UTC](https://discourse.julialang.org/t/font-family-computer-modern-not-found/93355 "2023-01-22T11:52:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 22, 2023, 11:52am UTC](https://discourse.julialang.org/t/font-family-computer-modern-not-found/93355/1 "2023-01-22T11:52:58Z")

</div>

Defining “Computer Modern” as default font familly is very convenient when using Plots.jl default gr() backend, [as per this other post](https://discourse.julialang.org/t/nice-fonts-with-plots-gr-and-latexstrings/60037).

However, using the `pyplot` or `pythonplot` backends issues the warning message:

```julia
findfont: Font family ['Computer Modern'] not found.

```

Is it possible to fix this font problem?

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [January 22, 2023, 2:34pm UTC](https://discourse.julialang.org/t/font-family-computer-modern-not-found/93355/2 "2023-01-22T14:34:59Z")

</div>

Since no one else is answering, here’s some input, maybe useful: Computer Modern is Knuth’s font for TeX. In the post you reference it’s however being used by MathJax so it’s not clear to me what’s happening here. The suggestion of using “Computer Modern” may be specific to that setup with specific backends. In any case, I’m not sure that Computer Modern is a good font choice, Knuth last updated it in 1992. I’m sure there are better, TTF or OTF, font available now.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 23, 2023, 8:04pm UTC](https://discourse.julialang.org/t/font-family-computer-modern-not-found/93355/3 "2023-01-23T20:04:55Z")

</div>

Thanks for your response.

There is a “cm” font for pythonplot() backend :

```julia
using Plots; pythonplot(dpi=100)
plot(sin, fontfamily="cm", tickfontsize=20)

```

which issues the same error:  
`findfont: Font family 'cm' not found.`

however, what is plotted does look like “Computer Modern”.

Could someone enlighten if pythonplot’s “cm” and gr’s “Computer Modern” could be matched, so that when we change backend we can keep the same font family.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 31, 2023, 11:01pm UTC](https://discourse.julialang.org/t/font-family-computer-modern-not-found/93355/4 "2023-01-31T23:01:07Z")

</div>

I’m sorry if this might be a pointless and thankless question, but even if it is, I’d like to know that too.

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [February 1, 2023, 3:31pm UTC](https://discourse.julialang.org/t/font-family-computer-modern-not-found/93355/5 "2023-02-01T15:31:08Z")

</div>

Not a solution, just two cents worth of observations.

`matplotlib` finds the following Computer Modern related fonts on my system. They ship with mpl.

```julia
In [45]: font_list = sorted(matplotlib.font_manager.get_font_names())

[...]
 'cmb10',
 'cmex10',
 'cmmi10',
 'cmr10',
 'cmss10',
 'cmsy10',
 'cmtt10',
[...]

```

So `Plots.plot(..., xlabel="x", fontfamily="cmr10")` (“Computer Modern Roman”) works for setting the non-math font, but it sadly won’t select _cm_ as the math font. Plots just doesn’t know how to translate `cmr10` into the appropriate math font. I had thought this could be achieved by setting `Plots.PythonPlot.matplotlib.rcParams["mathtext.fontset"] = "cm"`, but alas Plots has other plans and keeps falling back to `dejavu` for math.

---

<div class="post-metadata">

**Author:** ![Xingnianhe](https://avatars.discourse-cdn.com/v4/letter/x/ee59a6/32.png) [@Xingnianhe](https://discourse.julialang.org/u/Xingnianhe)\
**Post date:** [April 13, 2025, 3:25am UTC](https://discourse.julialang.org/t/font-family-computer-modern-not-found/93355/6 "2025-04-13T03:25:40Z")

</div>

maybe you should use fontset=“cm”?
