From cae03023f7ebb2bc0c021da637d48255b207017c Mon Sep 17 00:00:00 2001 From: Chirag3841 Date: Sun, 19 Apr 2026 09:37:56 +0530 Subject: [PATCH 1/2] supporting fontweight options specially bold ones --- lib/matplotlib/font_manager.py | 3 +++ lib/matplotlib/tests/test_font_manager.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 0a5588d13452..db1ef204466b 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -93,6 +93,9 @@ 'bold': 700, 'heavy': 800, 'extra bold': 800, + 'extrabold': 800, + 'superbold': 800, + 'ultrabold': 800, 'black': 900, } _weight_regexes = [ diff --git a/lib/matplotlib/tests/test_font_manager.py b/lib/matplotlib/tests/test_font_manager.py index 1b6e7b4778a1..ac9ef83fb03f 100644 --- a/lib/matplotlib/tests/test_font_manager.py +++ b/lib/matplotlib/tests/test_font_manager.py @@ -427,6 +427,9 @@ def test_normalize_weights(): assert _normalize_weight('bold') == 700 assert _normalize_weight('heavy') == 800 assert _normalize_weight('extra bold') == 800 + assert _normalize_weight('extrabold') == 800 + assert _normalize_weight('superbold') == 800 + assert _normalize_weight('ultrabold') == 800 assert _normalize_weight('black') == 900 with pytest.raises(KeyError): _normalize_weight('invalid') From 83a6b6034fb2087b67c3636be91ced19829727f4 Mon Sep 17 00:00:00 2001 From: Chirag3841 Date: Mon, 20 Apr 2026 22:39:39 +0530 Subject: [PATCH 2/2] obvious missing keys added --- lib/matplotlib/font_manager.py | 3 +++ lib/matplotlib/tests/test_font_manager.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index db1ef204466b..c38501f11d84 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -96,6 +96,9 @@ 'extrabold': 800, 'superbold': 800, 'ultrabold': 800, + 'ultrablack': 1000, + 'superblack': 1000, + 'extrablack': 1000, 'black': 900, } _weight_regexes = [ diff --git a/lib/matplotlib/tests/test_font_manager.py b/lib/matplotlib/tests/test_font_manager.py index ac9ef83fb03f..1fddb74c60fd 100644 --- a/lib/matplotlib/tests/test_font_manager.py +++ b/lib/matplotlib/tests/test_font_manager.py @@ -430,6 +430,9 @@ def test_normalize_weights(): assert _normalize_weight('extrabold') == 800 assert _normalize_weight('superbold') == 800 assert _normalize_weight('ultrabold') == 800 + assert _normalize_weight('ultrablack') == 1000 + assert _normalize_weight('superblack') == 1000 + assert _normalize_weight('extrablack') == 1000 assert _normalize_weight('black') == 900 with pytest.raises(KeyError): _normalize_weight('invalid')