@@ -67,6 +67,13 @@ class TexManager:
67
67
_grey_arrayd = {}
68
68
69
69
_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
+ )
70
77
_font_preambles = {
71
78
'new century schoolbook' : r'\renewcommand{\rmdefault}{pnc}' ,
72
79
'bookman' : r'\renewcommand{\rmdefault}{pbk}' ,
@@ -80,13 +87,10 @@ class TexManager:
80
87
'helvetica' : r'\usepackage{helvet}' ,
81
88
'avant garde' : r'\usepackage{avant}' ,
82
89
'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 ,
90
94
}
91
95
_font_types = {
92
96
'new century schoolbook' : 'serif' ,
@@ -200,6 +204,7 @@ def _get_tex_source(cls, tex, fontsize):
200
204
font_preamble , fontcmd = cls ._get_font_preamble_and_command ()
201
205
baselineskip = 1.25 * fontsize
202
206
return "\n " .join ([
207
+ r"\RequirePackage{fix-cm}" ,
203
208
r"\documentclass{article}" ,
204
209
r"% Pass-through \mathdefault, which is used in non-usetex mode" ,
205
210
r"% to use the default text font but was historically suppressed" ,
0 commit comments