From 64772f50f7dd0dc3e2e07241858774750491b674 Mon Sep 17 00:00:00 2001 From: Charissa Miller <48832936+clemiller@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:15:18 -0400 Subject: [PATCH] compatibility with pillow 10 --- mitreattack/navlayers/exporters/svg_objects.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mitreattack/navlayers/exporters/svg_objects.py b/mitreattack/navlayers/exporters/svg_objects.py index 892561a8..9c147c0a 100644 --- a/mitreattack/navlayers/exporters/svg_objects.py +++ b/mitreattack/navlayers/exporters/svg_objects.py @@ -38,7 +38,7 @@ def _getstringwidth(string, font, size): :return: pixel length of string """ font = ImageFont.truetype(f"{os.path.sep.join(__file__.split(os.path.sep)[:-1])}/fonts/{font}.ttf", int(size)) - length, _ = font.getsize(string) + length, _ = font.getbbox(string)[2:4] return length @@ -51,7 +51,7 @@ def _getstringheight(string, font, size): :return: pixel height of string """ font = ImageFont.truetype(f"{os.path.sep.join(__file__.split(os.path.sep)[:-1])}/fonts/{font}.ttf", int(size)) - _, height = font.getsize(string) + _, height = font.getbbox(string)[2:4] return height