@@ -67,6 +67,13 @@ class TexManager:
6767 _grey_arrayd = {}
6868
6969 _font_families = ('serif' , 'sans-serif' , 'cursive' , 'monospace' )
70+ # Check for the cm-super package (which registers unicode computer modern
71+ # support just by being installed) without actually loading any package
72+ # (because we already load the incompatible fix-cm).
73+ _check_cmsuper_installed = (
74+ r'\IfFileExists{type1ec.sty}{}{\PackageError{matplotlib-support}{'
75+ r'Missing cm-super package, required by Matplotlib}{}}'
76+ )
7077 _font_preambles = {
7178 'new century schoolbook' : r'\renewcommand{\rmdefault}{pnc}' ,
7279 'bookman' : r'\renewcommand{\rmdefault}{pbk}' ,
@@ -80,13 +87,10 @@ class TexManager:
8087 'helvetica' : r'\usepackage{helvet}' ,
8188 'avant garde' : r'\usepackage{avant}' ,
8289 'courier' : r'\usepackage{courier}' ,
83- # Loading the type1ec package ensures that cm-super is installed, which
84- # is necessary for Unicode computer modern. (It also allows the use of
85- # computer modern at arbitrary sizes, but that's just a side effect.)
86- 'monospace' : r'\usepackage{type1ec}' ,
87- 'computer modern roman' : r'\usepackage{type1ec}' ,
88- 'computer modern sans serif' : r'\usepackage{type1ec}' ,
89- 'computer modern typewriter' : r'\usepackage{type1ec}' ,
90+ 'monospace' : _check_cmsuper_installed ,
91+ 'computer modern roman' : _check_cmsuper_installed ,
92+ 'computer modern sans serif' : _check_cmsuper_installed ,
93+ 'computer modern typewriter' : _check_cmsuper_installed ,
9094 }
9195 _font_types = {
9296 'new century schoolbook' : 'serif' ,
@@ -200,6 +204,7 @@ def _get_tex_source(cls, tex, fontsize):
200204 font_preamble , fontcmd = cls ._get_font_preamble_and_command ()
201205 baselineskip = 1.25 * fontsize
202206 return "\n " .join ([
207+ r"\RequirePackage{fix-cm}" ,
203208 r"\documentclass{article}" ,
204209 r"% Pass-through \mathdefault, which is used in non-usetex mode" ,
205210 r"% to use the default text font but was historically suppressed" ,
0 commit comments