Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/api/next_api_changes/behavior/23270-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The *math* parameter of ``mathtext.get_unicode_index`` is deprecated and defaults to False
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In math mode, ASCII hyphens (U+002D) are now replaced by unicode minus signs
(U+2212) at the parsing stage.
5 changes: 0 additions & 5 deletions doc/api/next_api_changes/deprecations/22507-AL.rst

This file was deleted.

6 changes: 3 additions & 3 deletions lib/matplotlib/_mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


@_api.delete_parameter("3.6", "math")
def get_unicode_index(symbol, math=True): # Publicly exported.
def get_unicode_index(symbol, math=False): # Publicly exported.
r"""
Return the integer index (from the Unicode table) of *symbol*.

Expand All @@ -43,8 +43,8 @@ def get_unicode_index(symbol, math=True): # Publicly exported.
symbol : str
A single (Unicode) character, a TeX command (e.g. r'\pi') or a Type1
symbol name (e.g. 'phi').
math : bool, default: True
If False, always treat as a single Unicode character.
math : bool, default: False
If True (deprecated), replace ASCII hyphen-minus by Unicode minus.
"""
# From UTF #25: U+2212 minus sign is the preferred
# representation of the unary and binary minus sign rather than
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
# 'svgastext' tests switch svg output to embed text as text (rather than as
# paths).
svgastext_math_tests = [
r'$-$-',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent test case!

]
# 'lightweight' tests test only a single fontset (dejavusans, which is the
# default) and only png outputs, in order to minimize the size of baseline
Expand Down Expand Up @@ -206,11 +207,10 @@ def test_mathtext_rendering(baseline_images, fontset, index, text):

@pytest.mark.parametrize('index, text', enumerate(svgastext_math_tests),
ids=range(len(svgastext_math_tests)))
@pytest.mark.parametrize(
'fontset', ['cm', 'stix', 'stixsans', 'dejavusans', 'dejavuserif'])
@pytest.mark.parametrize('fontset', ['cm', 'dejavusans'])
@pytest.mark.parametrize('baseline_images', ['mathtext0'], indirect=True)
@image_comparison(
baseline_images=None,
baseline_images=None, extensions=['svg'],
savefig_kwarg={'metadata': { # Minimize image size.
'Creator': None, 'Date': None, 'Format': None, 'Type': None}})
def test_mathtext_rendering_svgastext(baseline_images, fontset, index, text):
Expand Down