Skip to content

Commit f23a154

Browse files
committed
be more general with font weights
1 parent ae3b881 commit f23a154

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

matplotlib2tikz/text.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,15 @@ def draw_text(data, obj):
150150
# 'heavy' : 800,
151151
# 'extra bold' : 800,
152152
# 'black' : 900}
153-
if int(obj.get_weight()) > 550:
153+
#
154+
# get_weights returns a numeric value in the range 0-1000 or one of
155+
# ‘light’, ‘normal’, ‘regular’, ‘book’, ‘medium’, ‘roman’, ‘semibold’,
156+
# ‘demibold’, ‘demi’, ‘bold’, ‘heavy’, ‘extra bold’, ‘black’
157+
weight = obj.get_weight()
158+
if weight in [
159+
'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold',
160+
'black'
161+
] or (isinstance(weight, int) and weight > 550):
154162
style.append('\\bfseries')
155163

156164
if obj.axes:

0 commit comments

Comments
 (0)