# Missing font in ROOT plot

**URL:** <https://root-forum.cern.ch/t/missing-font-in-root-plot/31049>\
**Category:** General Chat\
**Created:** [October 9, 2018, 8:18am UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049 "2018-10-09T08:18:32Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![afiqaize](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afiqaize/32/14407_2.png) [@afiqaize](https://root-forum.cern.ch/u/afiqaize)\
**Post date:** [October 9, 2018, 8:18am UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/1 "2018-10-09T08:18:32Z")

</div>

Hi experts,

Below is attached the screenshot of a plot I have. It used to look completely right, with the Delta being the upright triangle letter and phi being… the other phi. Let’s say back when the plot looked right, TLatex ‘#phi’ would not give this one, instead I need to use ‘#varphi’. Then comes this new system (Ubuntu 18.04) and this particular font somehow managed to elude my font installation spree.

So my question is: how do I know exactly which font Delta phi needs and install it / have my system recognize it / just get everything to work? Somehow the same Delta phi looks just nice in pdf files compiled off Latex, it’s just the ROOT plots that don’t work (and by extension ROOT plots put into Latex files).

Cheers,  
Afiq

![dPhi](https://root-forum.cern.ch/uploads/default/original/3X/4/d/4d990622f80f25ae1f25eba715be8ef6fadf8dd4.png)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [October 9, 2018, 8:43am UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/2 "2018-10-09T08:43:03Z")

</div>

In principle all the fonts ROOT needs are in `$ROOTSYS/fonts`. Can you post the exact text string you give as axis title ?

---

<div class="post-metadata">

**Author:** ![afiqaize](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afiqaize/32/14407_2.png) [@afiqaize](https://root-forum.cern.ch/u/afiqaize)\
**Post date:** [October 9, 2018, 8:51am UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/3 "2018-10-09T08:51:02Z")

</div>

Hi,

`
const std::string xTxt = "d#sigma / d#Delta#phi [pb]";
plot->GetXaxis()->SetTitle(xTxt.c_str());
`

It’s possible that `$ROOTSYS/fonts` is not being recognized by the system/evince. How can I check if this is the case? Having to source thisroot.sh just to view a pdf file doesn’t sound right…

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [October 9, 2018, 9:16am UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/4 "2018-10-09T09:16:21Z")

</div>

```auto
root [0] auto T = new TLatex(.5,.5,"d#sigma / d#Delta#phi [pb]");
root [1] T->Draw()

```

gives me on screen:

![00](https://root-forum.cern.ch/uploads/default/original/3X/3/5/356894ae857bb827f0662c1896d936a6b5d602d7.jpeg)

It also gives me the same thing when I visualise the pdf using **preview** on Mac. Yes it could be that **evince** has a problem on your machine. I installed **evince** on my Mac and I can see the formula correctly also.

---

<div class="post-metadata">

**Author:** ![afiqaize](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afiqaize/32/14407_2.png) [@afiqaize](https://root-forum.cern.ch/u/afiqaize)\
**Post date:** [October 9, 2018, 10:12am UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/5 "2018-10-09T10:12:34Z")

</div>

Uhm yeah, that’s what I said too. And the question was how do I identify exactly which font is needed for it to show correctly so I can see if I have them and see whether it’s evince or somewhere else in my system.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [October 9, 2018, 10:18am UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/6 "2018-10-09T10:18:47Z")

</div>

The font to render greek letters must be “symbol”. It seems your installation of evince is buggy. May be try with another pdf viewer if you have one (adobe ? gs ?) . Does it print correctly ? can you post the pdf file so I can check if I can visualise it correctly ?

---

<div class="post-metadata">

**Author:** ![afiqaize](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afiqaize/32/14407_2.png) [@afiqaize](https://root-forum.cern.ch/u/afiqaize)\
**Post date:** [October 9, 2018, 11:22am UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/7 "2018-10-09T11:22:07Z")

</div>

Thanks for the pointers. So I copied the fonts in `$ROOTSYS/fonts` to a `~/.fonts` directory and did `fc-cache -f -v`. Now phi looks right, but Delta got replaced with empty set symbol for reasons unknown.

Installed a new pdf viewer and then somehow it looks ok. Bye evince, the last 2 days were fun.

---

<div class="post-metadata">

**Author:** ![victor-gonzalez](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/victor-gonzalez/32/17841_2.png) [@victor-gonzalez](https://root-forum.cern.ch/u/victor-gonzalez)\
**Post date:** [January 23, 2019, 5:30pm UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/8 "2019-01-23T17:30:49Z")

</div>

To me the proposed solution was not an option. It wasn’t only `evince`, `okular` did not work either and, perhaps, the most relevant to me, `kile`, the `LaTeX` editor I use, when incorporates plots produced by ROOT.

So after few hours digging into this I found, comparing with a 16.04 system which worked fine, that a font config file was missing, `/etc/fonts/conf.avail/30-metric-aliases.conf` and a symbolic link to it from `/etc/fonts/conf.d/30-urw-aliases.conf`.

You’ll find the file content below. Without it, the substitution font which was mapped to the Symbol font asked by ROOT within the `.pdf` file was `OpenSymbol` which didn’t work although inspecting it it seems to have the required symbols to render. With the missing file and symbolic link incorporated the Symbol font asked by ROOT within the `.pdf` file was substituted by `Standard Symbols L` which did perfectly its job.

```auto
ls -l /etc/fonts/conf.d/30-urw-aliases.conf 
lrwxrwxrwx 1 root root 33 ene 23 17:16 /etc/fonts/conf.d/30-urw-aliases.conf -> ../conf.avail/30-urw-aliases.conf

more /etc/fonts/conf.avail/30-urw-aliases.conf 
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
  URW provides metric and shape compatible fonts for some Adobe families.
  Most of these are handled in 30-metric-aliases.conf.
  -->
	<alias binding="same">
	  <family>Zapf Dingbats</family>
	  <accept><family>Dingbats</family></accept>
	</alias>
	<alias binding="same">
	  <family>ITC Zapf Dingbats</family>
	  <accept><family>Dingbats</family></accept>
	</alias>
	<match target="pattern">
	  <test name="family" compare="eq" ignore-blanks="true">
	    <string>Symbol</string>
	  </test>
	  <edit name="family" mode="append" binding="same">
	    <string>Standard Symbols L</string>
	  </edit>
	</match>
</fontconfig>

```

---

<div class="post-metadata">

**Author:** ![afiqaize](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/afiqaize/32/14407_2.png) [@afiqaize](https://root-forum.cern.ch/u/afiqaize)\
**Post date:** [January 23, 2019, 10:05pm UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/9 "2019-01-23T22:05:29Z")

</div>

Did not exactly work for me, on Ubuntu 18.04, but thanks a lot for the major hint.

Basically, `fc-match --sort "Symbol"` should give `s050000l.pfb: "Standard Symbols L" "Regular"` as its top match. As far as I can tell, having these lines:

```auto
        <alias>
	  <family>Symbol</family>
          <accept><family>Standard Symbols L</family></accept>
        </alias>

```

on the system font config files e.g. `/etc/fonts/fonts.conf` would be enough, but in my case it matches to a symbol.ttf font that can’t seem to be overridden. So I just deleted that font and refreshed the cache following [https://askubuntu.com/questions/371213/how-to-delete-fonts-in-ubuntu](https://askubuntu.com/questions/371213/how-to-delete-fonts-in-ubuntu) and now ROOT plots look fine in most PDF viewers. Why it was fine in MuPDF without any of this, one can only guess…

In any case, thanks again Victor.

---

<div class="post-metadata">

**Author:** ![peter\_berta](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/p/ecc23a/32.png) [@peter\_berta](https://root-forum.cern.ch/u/peter_berta)\
**Post date:** [March 25, 2019, 9:17pm UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/10 "2019-03-25T21:17:11Z")

</div>

I had the same problem on Ubuntu 18.04 and the reply from victor-gonzalez solved this problem. Thank you, Victor!

---

<div class="post-metadata">

**Author:** ![fabio\_root](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@fabio\_root](https://root-forum.cern.ch/u/fabio_root)\
**Post date:** [August 12, 2019, 9:57am UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/11 "2019-08-12T09:57:54Z")

</div>

Hi victor-gonzalez. Thank you very much this worked for me!  
Only a small thing, you said that the missing file was `/etc/fonts/conf.avail/30-metric-aliases.conf` but it was actually `/etc/fonts/conf.avail/30-urw-aliases.conf` as you correctly indicated in the code snippet.

---

<div class="post-metadata">

**Author:** ![mikeg](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@mikeg](https://root-forum.cern.ch/u/mikeg)\
**Post date:** [January 10, 2020, 5:51pm UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/13 "2020-01-10T17:51:10Z")

</div>

I had similar success with MATE 18.04. Very glad to get this fixed.

---

<div class="post-metadata">

**Author:** ![aardwolf](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/e274bd/32.png) [@aardwolf](https://root-forum.cern.ch/u/aardwolf)\
**Post date:** [May 11, 2020, 7:43pm UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/14 "2020-05-11T19:43:25Z")

</div>

I have the same problem with Ubuntu 18.04. Victor’s solution doesn’t quite work for me. My solution is saving the plot into .eps format and then converting the eps plot into pdf using `epstopdf` (`epspdf` doesn’t work for me).

---

<div class="post-metadata">

**Author:** ![awen](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/59ef9b/32.png) [@awen](https://root-forum.cern.ch/u/awen)\
**Post date:** [June 2, 2020, 4:24pm UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/15 "2020-06-02T16:24:25Z")

</div>

The solution provided by Victor solves my problem as well.  
For those who have the same problem and do not have the sudo privilege, saving it as `~/.fonts.conf` or `~/.fonts.conf.d` also does the work for me.

---

<div class="post-metadata">

**Author:** ![skratch](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@skratch](https://root-forum.cern.ch/u/skratch)\
**Post date:** [April 19, 2021, 3:21pm UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/16 "2021-04-19T15:21:31Z")

</div>

Just to re-confirm: This fixes the issue for me as well (had to close/open the terminal).  
This also fixes the varphi/phi confusion for me (finally!!)

---

<div class="post-metadata">

**Author:** ![Steven\_Nall](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/steven_nall/32/28439_2.png) [@Steven\_Nall](https://root-forum.cern.ch/u/Steven_Nall)\
**Post date:** [January 11, 2022, 12:07pm UTC](https://root-forum.cern.ch/t/missing-font-in-root-plot/31049/17 "2022-01-11T12:07:45Z")

</div>

I have the same problem
