Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4f26d9a

Browse filesBrowse files
authored
Merge pull request #30100 from anntzer/fcm
Use fix-cm instead of type1cm.
2 parents 2fa96ed + 46255ae commit 4f26d9a
Copy full SHA for 4f26d9a

File tree

Expand file treeCollapse file tree

6 files changed

+25
-12
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+25
-12
lines changed

‎doc/install/dependencies.rst

Copy file name to clipboardExpand all lines: doc/install/dependencies.rst
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ will often automatically include these collections.
443443
| | `lm <https://ctan.org/pkg/lm>`_, |
444444
| | `txfonts <https://ctan.org/pkg/txfonts>`_ |
445445
+-----------------------------+--------------------------------------------------+
446-
| collection-latex | `geometry <https://ctan.org/pkg/geometry>`_, |
446+
| collection-latex | `fix-cm <https://ctan.org/pkg/fix-cm>`_, |
447+
| | `geometry <https://ctan.org/pkg/geometry>`_, |
447448
| | `hyperref <https://ctan.org/pkg/hyperref>`_, |
448449
| | `latex <https://ctan.org/pkg/latex>`_, |
449450
| | latex-bin, |

‎lib/matplotlib/mpl-data/matplotlibrc

Copy file name to clipboardExpand all lines: lib/matplotlib/mpl-data/matplotlibrc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
# become quite long.
340340
# The following packages are always loaded with usetex,
341341
# so beware of package collisions:
342-
# geometry, inputenc, type1cm.
342+
# color, fix-cm, geometry, graphicx, textcomp.
343343
# PostScript (PSNFSS) font packages may also be
344344
# loaded, depending on your font settings.
345345

‎lib/matplotlib/mpl-data/stylelib/classic.mplstyle

Copy file name to clipboardExpand all lines: lib/matplotlib/mpl-data/stylelib/classic.mplstyle
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURE
122122
# Note that it has to be put on a single line, which may
123123
# become quite long.
124124
# The following packages are always loaded with usetex, so
125-
# beware of package collisions: color, geometry, graphicx,
126-
# type1cm, textcomp.
125+
# beware of package collisions:
126+
# color, fix-cm, geometry, graphicx, textcomp.
127127
# Adobe Postscript (PSSNFS) font packages may also be
128128
# loaded, depending on your font settings.
129129

‎lib/matplotlib/tests/test_backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_svg.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def test_unicode_won():
216216

217217
tree = xml.etree.ElementTree.fromstring(buf)
218218
ns = 'http://www.w3.org/2000/svg'
219-
won_id = 'SFSS3583-8e'
219+
won_id = 'SFSS1728-8e'
220220
assert len(tree.findall(f'.//{{{ns}}}path[@d][@id="{won_id}"]')) == 1
221221
assert f'#{won_id}' in tree.find(f'.//{{{ns}}}use').attrib.values()
222222

‎lib/matplotlib/tests/test_usetex.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_usetex.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,10 @@ def test_rotation():
185185
# 'My' checks full height letters plus descenders.
186186
ax.text(x, y, f"$\\mathrm{{My {text[ha]}{text[va]} {angle}}}$",
187187
rotation=angle, horizontalalignment=ha, verticalalignment=va)
188+
189+
190+
def test_unicode_sizing():
191+
tp = mpl.textpath.TextToPath()
192+
scale1 = tp.get_glyphs_tex(mpl.font_manager.FontProperties(), "W")[0][0][3]
193+
scale2 = tp.get_glyphs_tex(mpl.font_manager.FontProperties(), r"\textwon")[0][0][3]
194+
assert scale1 == scale2

‎lib/matplotlib/texmanager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/texmanager.py
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.