Missing font in ROOT plot

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).



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


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…

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

gives me on screen:


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.

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.

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 ?

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.

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.

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">
  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>
	<alias binding="same">
	  <family>ITC Zapf Dingbats</family>
	<match target="pattern">
	  <test name="family" compare="eq" ignore-blanks="true">
	  <edit name="family" mode="append" binding="same">
	    <string>Standard Symbols L</string>

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:

          <accept><family>Standard Symbols L</family></accept>

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 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.

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

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.

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

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).

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.

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!!)

I have the same problem