Font not carrying through Py2Exe

Hi there,
I've made a program that makes plots using New Century Schoolbook Lt Std
font. I did this by inserting this into the matplotlibrc file:

font.family : New Century Schoolbook LT Std # serif #sans-serif

There's also a "fontlist.cache" file that I think points to it when it says:

.
.
.
(dp283
g12
g45
sg14
S'New Century Schoolbook LT Std'
p284
sg16
I400
sg17
g13
sg18
.
.
.

This all works fine on my computer. But I'm trying to make it run on other
people's computers (off a network drive) but when I do the plots all go back
into Ariel font and all the spacing and stuff gets screwed up. Running the
exact same exe from the same place, my computer continues to make them with
the correct font. I have copied the matplotlibrc file and the
fontlist.cache file from my hard drive (C:...Matplotlib) to the mpl-data
folder in the dist folder (from py2exe) but that didn't work.

Does anyone have any ideas for fixing this stuff? I think it might just be
a matter of including the right files in the Py2Exe setup file but I don't
know which ones. Or maybe changing how I select the font, which was a
roundabout way of doing it from the start. When I run the plots
(successfully on my computer) it says this at one point:

c:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.py:982:
UserWarning: 'newcenturyschlbkltstd-roman.otf' can not be subsetted into a
Type 3 font. The entire font will be embedded in the output.

Maybe that has somethign to do with what's going on?

Thanks a lot,
Alex

···

--
View this message in context: http://old.nabble.com/Font-not-carrying-through-Py2Exe-tp30663871p30663871.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Hi there,
I've made a program that makes plots using New Century Schoolbook Lt Std
font. I did this by inserting this into the matplotlibrc file:

font.family : New Century Schoolbook LT Std # serif #sans-serif

There's also a "fontlist.cache" file that I think points to it when it says:

.
(dp283
g12
g45
sg14
S'New Century Schoolbook LT Std'
p284
sg16
I400
sg17
g13
sg18
.

This all works fine on my computer. But I'm trying to make it run on other
people's computers (off a network drive) but when I do the plots all go back
into Ariel font and all the spacing and stuff gets screwed up. Running the
exact same exe from the same place, my computer continues to make them with
the correct font. I have copied the matplotlibrc file and the
fontlist.cache file from my hard drive (C:...Matplotlib) to the mpl-data
folder in the dist folder (from py2exe) but that didn't work.

Does anyone have any ideas for fixing this stuff? I think it might just be
a matter of including the right files in the Py2Exe setup file but I don't
know which ones. Or maybe changing how I select the font, which was a
roundabout way of doing it from the start.

The fontList.cache file maps from the properties (names, weights, slants) etc. of the fonts available on a particular system to their file path. You should definitely not ship this file with the exe, but rather allow it to be regenerated from scratch on each system, since the selection and locations of fonts is very likely to be different.

I think "New Century Schoolbook" is one of the fonts that ships with Windows, so you can probably count on it being there. If not, you need to ship the font as part of the exe by adding it to mpl-data/fonts/ttf and then following the instructions to include the fonts given here:

http://www.py2exe.org/index.cgi/MatPlotLib

   When I run the plots
(successfully on my computer) it says this at one point:

c:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.py:982:
UserWarning: 'newcenturyschlbkltstd-roman.otf' can not be subsetted into a
Type 3 font. The entire font will be embedded in the output.

Maybe that has somethign to do with what's going on?
   

I don't think that's related. All this means is that when it embeds the font into the PDF file, it has to embed the entire thing rather than only the characters that are being used. (Resulting in a larger PDF file, but otherwise fine.) To avoid this message, you can set the rcParam "pdf.fonttype" to 42.

Cheers,
Mike

···

On 01/13/2011 11:38 AM, Alex S wrote:

Thanks a lot,
Alex
   
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

Thank you very much for the help, I'm sorry I didn't reply to you. I ended
up doing what you recommend against, which is I took my fontlist.cache and
copied it to the other computers C:\Documents and
Settings\username\.matplotlib folder. This worked, maybe because all the
computers here have the same font that for some reason didn't get included
in the fontlist for everyone else. I know it's not perfect and that if I
tried to get the program to work for anyone outside of work it would
probably crash horribly, but it works now so I think I'll just leave it.

Thank you very much Mike, you might not remember but you were the one that
taught me how to get it into New Century Schoolbook in the first place.
http://old.nabble.com/Changing-the-font-td28111472.html#a28118916 Here it is
, for old times sake.

Michael Droettboom-3 wrote:

···

On 01/13/2011 11:38 AM, Alex S wrote:

Hi there,
I've made a program that makes plots using New Century Schoolbook Lt Std
font. I did this by inserting this into the matplotlibrc file:

font.family : New Century Schoolbook LT Std # serif #sans-serif

There's also a "fontlist.cache" file that I think points to it when it
says:

.
.
.
(dp283
g12
g45
sg14
S'New Century Schoolbook LT Std'
p284
sg16
I400
sg17
g13
sg18
.
.
.

This all works fine on my computer. But I'm trying to make it run on
other
people's computers (off a network drive) but when I do the plots all go
back
into Ariel font and all the spacing and stuff gets screwed up. Running
the
exact same exe from the same place, my computer continues to make them
with
the correct font. I have copied the matplotlibrc file and the
fontlist.cache file from my hard drive (C:...Matplotlib) to the mpl-data
folder in the dist folder (from py2exe) but that didn't work.

Does anyone have any ideas for fixing this stuff? I think it might just
be
a matter of including the right files in the Py2Exe setup file but I
don't
know which ones. Or maybe changing how I select the font, which was a
roundabout way of doing it from the start.

The fontList.cache file maps from the properties (names, weights,
slants) etc. of the fonts available on a particular system to their file
path. You should definitely not ship this file with the exe, but rather
allow it to be regenerated from scratch on each system, since the
selection and locations of fonts is very likely to be different.

I think "New Century Schoolbook" is one of the fonts that ships with
Windows, so you can probably count on it being there. If not, you need
to ship the font as part of the exe by adding it to mpl-data/fonts/ttf
and then following the instructions to include the fonts given here:

http://www.py2exe.org/index.cgi/MatPlotLib

   When I run the plots
(successfully on my computer) it says this at one point:

c:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.py:982:
UserWarning: 'newcenturyschlbkltstd-roman.otf' can not be subsetted into
a
Type 3 font. The entire font will be embedded in the output.

Maybe that has somethign to do with what's going on?
   

I don't think that's related. All this means is that when it embeds the
font into the PDF file, it has to embed the entire thing rather than
only the characters that are being used. (Resulting in a larger PDF
file, but otherwise fine.) To avoid this message, you can set the
rcParam "pdf.fonttype" to 42.

Cheers,
Mike

Thanks a lot,
Alex
   
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
View this message in context: http://old.nabble.com/Font-not-carrying-through-Py2Exe-tp30663871p30676209.html
Sent from the matplotlib - users mailing list archive at Nabble.com.