# Fonts in graph (graph theory) pictures are Type 3???

I am writing my thesis. One requirement is I can not have any Type 3 fonts. My document does have Type 3 fonts (Go to File, Properties, then the Font tab in Adobe Reader to check) and I believe it is caused by the graphs I have drawn with Sage, which I save as PDFs and then include with \includegraphics in LaTeX. For example:

g=graphs.CycleGraph(5)
g.relabel(lambda i: i+1)
graph_plot = g.plot(talk=True)
graph_plot.save('5cycle.pdf')


It is listed as "BitstreamVeraSans-Roman". I am using the thesis LaTeX template provided by my university, and I have not added any statements that tell it to use a certain font anywhere, so I don't think it's possible that the Type 3 font is anywhere in my text, unless the person who made the template is a jerk.

That left me to guess it is in my pictures. I googled "bistream verasans roman sage" and came across this question which suggests it is possible. I also deleted out 70% of my thesis, starting from the spot where the first figure appears, so that I deleted out all figures created as PDFs in Sage. And, now there are no Type 3 fonts.

Is it possible to change the font used? I guess it is the font used in labeling the vertices of the graphs??? Or, is it possible to explain why these fonts were used so I can try to explain why these fonts will not cause a problem? The reason we can not use Type 3 fonts is because this website says they cause problems, essentially that Type 1 fonts appear nicer when you are reading it on the screen.

edit retag close merge delete

Sort by » oldest newest most voted

This seems to be controlled by matplotlib. See this blog post for a workaround. Unfortunately, I don't think there is any easy way to pass those parameters to matplotlib via Sage.

EDIT: See @jason-grout 's message below for a way by using a matplotlibrc file. Create the file in the working directory with the required matplotlib parameters as mentioned in the blog post.

more

Do you think that is something that could be patched into Sage? I mean, the only reason I ever used Sage for my graphs is because William Stein has a graph theory video talking where he mentions how awesome Sage graphs are, high quality, blah blah blah. And, yet, apparently according to my university and the blog post you gave and the website I shared above, there are lots of places where you are not allowed to even use Type 3 fonts, and thus these graphs are bad quality in some ways. If Sage isn't patched, my alternative is to learn some new program and re-create every graph in my thesis, which I don't have time to do.

( 2012-12-08 03:12:53 -0500 )edit

Try [this patch](https://raw.github.com/ppurka/sage-patches/master/sage_devel/type1-fonts.patch). It seems to work for me. To apply, run the following commands (can't get rid of the link below): cd SAGE_ROOT/devel/sage hg qimport -P https://raw.github.com/ppurka/sage-patches/master/sage_devel/type1-fonts.patch ../../sage -b

( 2012-12-08 03:52:09 -0500 )edit
2

You probably could just put those lines in a matplotlibrc file. You could put the matplotlibrc file in the current directory or in the ~/.sage/ directory (see http://matplotlib.org/users/customizing.html#the-matplotlibrc-file). That way you don't have to patch Sage.

( 2012-12-08 15:09:41 -0500 )edit

@jasonGrout So, is this something that should be changed in Sage for future releases? Again, as my above comment says, if many publications don't allow Type 3 fonts, would it not be better to use Type 1 fonts, especially if there's an easy fix?

( 2012-12-10 03:02:31 -0500 )edit

Okay, had someone install the patch on our Sage server and now my thesis does not have any Type 3 fonts!!!! Thanks so much!

( 2012-12-10 05:03:43 -0500 )edit

I have added a patch at ticket 14664 to enable type 1 fonts at runtime.

more