File tree 2 files changed +18
-2
lines changed
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -909,7 +909,10 @@ def set_size(self, size):
909
909
try :
910
910
size = float (size )
911
911
except ValueError :
912
- if size is not None and size not in font_scalings :
912
+ try :
913
+ scale = font_scalings [size ]
914
+ size = scale * FontManager .get_default_size ()
915
+ except KeyError :
913
916
raise ValueError (
914
917
"Size is invalid. Valid font size are " + ", " .join (
915
918
str (i ) for i in font_scalings .keys ()))
@@ -941,7 +944,8 @@ def set_fontconfig_pattern(self, pattern):
941
944
942
945
def copy (self ):
943
946
"""Return a deep copy of self"""
944
- return FontProperties (_init = self )
947
+ return FontProperties (_init = self )
948
+
945
949
946
950
def ttfdict_to_fnames (d ):
947
951
"""
Original file line number Diff line number Diff line change @@ -393,3 +393,15 @@ def test_text_stale():
393
393
assert not ax1 .stale
394
394
assert not ax2 .stale
395
395
assert not fig .stale
396
+
397
+
398
+ @cleanup
399
+ def test_text_size_binding ():
400
+ from matplotlib .font_manager import FontProperties
401
+
402
+ matplotlib .rcParams ['font.size' ] = 10
403
+ fp = FontProperties (size = 'large' )
404
+ sz1 = fp .get_size_in_points ()
405
+ matplotlib .rcParams ['font.size' ] = 100
406
+
407
+ assert sz1 == fp .get_size_in_points ()
You can’t perform that action at this time.
0 commit comments