diff --git a/plotid/resources/__init__.py b/plotid/resources/__init__.py index 8d1c8b69c3fce7bea45c73efd06983e3c419a92f..8b137891791fe96927ad78e64b0aad7bded08bdc 100644 --- a/plotid/resources/__init__.py +++ b/plotid/resources/__init__.py @@ -1 +1 @@ - + diff --git a/plotid/tagplot_image.py b/plotid/tagplot_image.py index 51be3b88097a4633ba0c22ed21cc9b4d1afcef4c..282b2b06499b50d855ef06520e1212d68dbc8e48 100644 --- a/plotid/tagplot_image.py +++ b/plotid/tagplot_image.py @@ -44,7 +44,9 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer: color = tuple(rgb_value * 255 for rgb_value in plotid_object.fontcolor) # font = ImageFont.load_default() - font_path = files("plotid.resources").joinpath("OpenSans", "OpenSans-Regular.ttf") + font_path = ( + files("plotid.resources").joinpath("OpenSans").joinpath("OpenSans-Regular.ttf") + ) font = ImageFont.truetype(str(font_path), plotid_object.fontsize) if plotid_object.font: diff --git a/plotid/tagplot_matplotlib.py b/plotid/tagplot_matplotlib.py index 98ec025cbd94a9fc47d6ccab1735631817de175e..1da6cce9e058d1586f51047c9db0935b3abf053c 100644 --- a/plotid/tagplot_matplotlib.py +++ b/plotid/tagplot_matplotlib.py @@ -41,8 +41,12 @@ def tagplot_matplotlib(plotid_object: PlotOptions) -> PlotIDTransfer: matplotlib.font_manager.fontManager.addfont(plotid_object.font) font = matplotlib.font_manager.FontProperties(fname=plotid_object.font) else: - font = files("plotid.resources").joinpath("OpenSans", "OpenSans-Regular.ttf") - matplotlib.font_manager.fontManager.addfont(font) + font = ( + files("plotid.resources") + .joinpath("OpenSans") + .joinpath("OpenSans-Regular.ttf") + ) + matplotlib.font_manager.fontManager.addfont(str(font)) font = matplotlib.font_manager.FontProperties(fname=font) # Loop to create and position the IDs diff --git a/tests/test_tagplot_matplotlib.py b/tests/test_tagplot_matplotlib.py index 3cdfc376a27cdb9ffdbec877f91ecc5e4cdfa079..d7e59d9f3825a465614f3179088a8b4d501106d9 100644 --- a/tests/test_tagplot_matplotlib.py +++ b/tests/test_tagplot_matplotlib.py @@ -5,7 +5,6 @@ Unittests for tagplot_matplotlib """ import unittest -from importlib.resources import files import matplotlib.pyplot as plt from matplotlib.figure import Figure from plotid.tagplot_matplotlib import tagplot_matplotlib