Skip to content

Commit 61e329d

Browse files
committed
Small fixes to test_pdf_use14corefonts.py, thanks to Nicolas Grilly
svn path=/trunk/matplotlib/; revision=6905
1 parent a62bea7 commit 61e329d

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

unit/test_pdf_use14corefonts.py

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
1-
# encoding: utf-8
1+
# -*- encoding: utf-8 -*-
2+
"""
3+
Test the PDF backend with the option use14corefonts=True.
24
3-
import matplotlib
4-
matplotlib.use('PDF')
5+
Font cache issue
6+
----------------
7+
8+
The font cache doesn't record whether it was build with
9+
pdf.use14corefonts enabled or not, and the font name "Helvetica"
10+
happens to match "Helvetica Narrow", whose metrics are included with
11+
matplotlib, and using that AFM file without including the font itself
12+
breaks the output.
13+
14+
As a workaround, please reset the font cache by deleting
15+
~/.matplotlib/fontList.cache each time you enable or disable
16+
use14corefonts.
17+
"""
518

619
from matplotlib import rcParams
7-
import pylab
820

21+
rcParams['backend'] = 'pdf'
922
rcParams['pdf.use14corefonts'] = True
1023
rcParams['font.family'] = 'sans-serif'
1124
rcParams['font.size'] = 8
1225
rcParams['font.sans-serif'] = ['Helvetica']
1326

27+
import pylab
28+
1429
title = u'Test PDF backend with option use14corefonts=True'
1530

1631
text = u'''A three-line text positioned just above a blue line

0 commit comments

Comments
 (0)