@@ -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}' ,
@@ -83,10 +90,10 @@ class TexManager:
83
90
# Loading the type1ec package ensures that cm-super is installed, which
84
91
# is necessary for Unicode computer modern. (It also allows the use of
85
92
# 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}' ,
93
+ 'monospace' : _check_cmsuper_installed ,
94
+ 'computer modern roman' : _check_cmsuper_installed ,
95
+ 'computer modern sans serif' : _check_cmsuper_installed ,
96
+ 'computer modern typewriter' : _check_cmsuper_installed ,
90
97
}
91
98
_font_types = {
92
99
'new century schoolbook' : 'serif' ,
@@ -200,6 +207,7 @@ def _get_tex_source(cls, tex, fontsize):
200
207
font_preamble , fontcmd = cls ._get_font_preamble_and_command ()
201
208
baselineskip = 1.25 * fontsize
202
209
return "\n " .join ([
210
+ r"\RequirePackage{fix-cm}" ,
203
211
r"\documentclass{article}" ,
204
212
r"% Pass-through \mathdefault, which is used in non-usetex mode" ,
205
213
r"% to use the default text font but was historically suppressed" ,
0 commit comments