File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1663,7 +1663,7 @@ def _draw_bounding_box(
1663
1663
1664
1664
# Title background
1665
1665
if title_str :
1666
- textw , texth = font . getsize ( title_str )
1666
+ textw , texth = _get_text_size ( font , title_str )
1667
1667
bgtlx = boxtlx - linewidth + 1
1668
1668
bgbry = boxtly - linewidth + 1
1669
1669
bgbrx = bgtlx + textw + 2 * (label_text_pad_pixels + _DX )
@@ -1912,8 +1912,17 @@ def _parse_hex_color(h):
1912
1912
return rgb
1913
1913
1914
1914
1915
+ def _get_text_size (font , text_str ):
1916
+ try :
1917
+ _ , _ , w , h = font .getbbox (text_str )
1918
+ except AttributeError :
1919
+ w , h = font .getsize (text_str ) # Pillow<8
1920
+
1921
+ return w , h
1922
+
1923
+
1915
1924
def _compute_max_text_size (font , text_strs ):
1916
- sizes = [font . getsize ( s ) for s in text_strs ]
1925
+ sizes = [_get_text_size ( font , s ) for s in text_strs ]
1917
1926
width , height = np .max (sizes , axis = 0 )
1918
1927
return width , height
1919
1928
Original file line number Diff line number Diff line change 16
16
from wheel .bdist_wheel import bdist_wheel
17
17
18
18
19
- VERSION = "0.12.1 "
19
+ VERSION = "0.12.2 "
20
20
21
21
22
22
class BdistWheelCustom (bdist_wheel ):
You can’t perform that action at this time.
0 commit comments