Skip to content

Commit 120a9f1

Browse files
committed
Add boldsymbol mapping for symbols
1 parent 8ff72fc commit 120a9f1

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

lib/matplotlib/_mathtext.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2607,12 +2607,11 @@ def auto_delim(self, s, loc, toks):
26072607
def boldsymbol(self, s, loc, toks):
26082608
self.push_state()
26092609
state = self.get_state()
2610-
state.font = 'bfit'
26112610
hlist = []
26122611
name = toks["value"]
26132612
for c in name:
26142613
if isinstance(c, Char):
2615-
c.font = 'bfit'
2614+
c.font = "bsym"
26162615
c._update_metrics()
26172616
hlist.append(c)
26182617
else:

lib/matplotlib/_mathtext_data.py

+9
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,15 @@
12241224
(0x0041, 0x005a, 'rm', 0x1d670), # A-Z
12251225
(0x0061, 0x007a, 'rm', 0x1d68a) # a-z
12261226
],
1227+
'bsym':
1228+
[
1229+
(0x0030, 0x0039, 'bf', 0x1d7ec), # 0-9
1230+
(0x0041, 0x005a, 'bfit', 0x1d63c), # A-Z
1231+
(0x0061, 0x007a, 'bfit', 0x1d656), # a-z
1232+
(0x0393, 0x03a9, 'bf', 0x1d758), # \Gamma-Omega
1233+
(0x2207, 0x2207, 'bf', 0x1d76f), # \Nabla
1234+
(0x03b1, 0x03c9, 'bf', 0x1d770), # \alpha-\omega
1235+
],
12271236
}
12281237

12291238

lib/matplotlib/tests/test_mathtext.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
r'$\sum x\quad\sum^nx\quad\sum_nx\quad\sum_n^nx\quad\prod x\quad\prod^nx\quad\prod_nx\quad\prod_n^nx$', # GitHub issue 18085
135135
r'$1.$ $2.$ $19680801.$ $a.$ $b.$ $mpl.$',
136136
r'$\text{text}_{\text{sub}}^{\text{sup}} + \text{\$foo\$} + \frac{\text{num}}{\mathbf{\text{den}}}\text{with space, curly brackets \{\}, and dash -}$',
137-
r'$\boldsymbol{boldsymbol} \boldsymbol{\alpha} \boldsymbol{01234} \boldsymbol{\alpha * \beta}$',
137+
r'$\boldsymbol{abcde} \boldsymbol{\Gamma + \Omega} \boldsymbol{01234} \boldsymbol{\alpha * \beta}$',
138138
]
139139

140140
digits = "0123456789"
@@ -514,8 +514,5 @@ def test_mathtext_cmr10_minus_sign():
514514

515515
@check_figures_equal(extensions=["png"])
516516
def test_boldsymbol(fig_test, fig_ref):
517-
fig_test.text(0.1, 0.1, r"$\boldsymbol{abc0123\alpha}$")
518517
fig_test.text(0.1, 0.2, r"$\boldsymbol{\mathrm{abc0123\alpha}}$")
519-
520-
fig_ref.text(0.1, 0.1, r"$\mathbfit{abc0123\alpha}$")
521518
fig_ref.text(0.1, 0.2, r"$\mathrm{abc0123\alpha}$")

0 commit comments

Comments
 (0)