@@ -41,6 +41,8 @@ def check_for(texsystem):
4141 reason = 'xelatex + pgf is required' )
4242needs_pdflatex = pytest .mark .skipif (not check_for ('pdflatex' ),
4343 reason = 'pdflatex + pgf is required' )
44+ needs_lualatex = pytest .mark .skipif (not check_for ('lualatex' ),
45+ reason = 'lualatex + pgf is required' )
4446
4547
4648def compare_figure (fname , savefig_kwargs = {}, tol = 0 ):
@@ -205,6 +207,7 @@ def test_pdf_pages():
205207 rc_pdflatex = {
206208 'font.family' : 'serif' ,
207209 'pgf.rcfonts' : False ,
210+ 'pgf.texsystem' : 'pdflatex' ,
208211 }
209212 mpl .rcParams .update (rc_pdflatex )
210213
@@ -230,6 +233,7 @@ def test_pdf_pages_metadata():
230233 rc_pdflatex = {
231234 'font.family' : 'serif' ,
232235 'pgf.rcfonts' : False ,
236+ 'pgf.texsystem' : 'xelatex' ,
233237 }
234238 mpl .rcParams .update (rc_pdflatex )
235239
@@ -239,6 +243,30 @@ def test_pdf_pages_metadata():
239243 fig .tight_layout ()
240244
241245 md = {'author' : 'me' , 'title' : 'Multipage PDF with pgf' }
242- with PdfPages (os .path .join (result_dir , 'pdfpages .pdf' ), metadata = md ) as pdf :
246+ with PdfPages (os .path .join (result_dir , 'pdfpages_meta .pdf' ), metadata = md ) as pdf :
243247 pdf .savefig (fig )
244248 pdf .savefig (fig )
249+
250+
251+ @needs_lualatex
252+ @pytest .mark .style ('default' )
253+ @pytest .mark .backend ('pgf' )
254+ def test_pdf_pages_lualatex ():
255+ rc_pdflatex = {
256+ 'font.family' : 'serif' ,
257+ 'pgf.rcfonts' : False ,
258+ 'pgf.texsystem' : 'lualatex'
259+ }
260+ mpl .rcParams .update (rc_pdflatex )
261+
262+ fig = plt .figure ()
263+ ax = fig .add_subplot (1 , 1 , 1 )
264+ ax .plot (range (5 ))
265+ fig .tight_layout ()
266+
267+ md = {'author' : 'me' , 'title' : 'Multipage PDF with pgf' }
268+ with PdfPages (os .path .join (result_dir , 'pdfpages_lua.pdf' ), metadata = md ) as pdf :
269+ pdf .savefig (fig )
270+ pdf .savefig (fig )
271+
272+ raise Exception (result_dir )
0 commit comments