Skip to content

Commit

Permalink
Merge pull request #50 from zmoon/font
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Jul 17, 2023
2 parents 0ca235c + 655b49a commit be94dbf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 2 additions & 3 deletions doc/source/conf.py
Expand Up @@ -18,8 +18,7 @@

import os
import sys

from pkg_resources import get_distribution
from importlib.metadata import version as get_version

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -61,7 +60,7 @@
# built documents.
#
# get version using setuptools-scm
release = get_distribution("pydecorate").version
release = get_version("pydecorate")
# The full version, including alpha/beta/rc tags.
# for example take major/minor
version = ".".join(release.split(".")[:2])
Expand Down
9 changes: 6 additions & 3 deletions pydecorate/decorator_agg.py
Expand Up @@ -17,11 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Aggdraw-based image decoration class."""

from pathlib import Path

import aggdraw
from pkg_resources import resource_filename

from pydecorate.decorator_base import DecoratorBase

HERE = Path(__file__).parent


class DecoratorAGG(DecoratorBase):
"""Aggdraw-based image decoration class."""
Expand All @@ -30,8 +33,8 @@ def add_scale(self, colormap, **kwargs):
self._add_scale(colormap, **kwargs)

def _load_default_font(self):
font_path = resource_filename("pydecorate.fonts", "DejaVuSerif.ttf")
return aggdraw.Font("black", font_path, size=16)
font_path = HERE / "fonts" / "DejaVuSerif.ttf"
return aggdraw.Font("black", font_path.as_posix(), size=16)

def _load_font(self):
try:
Expand Down
1 change: 0 additions & 1 deletion pydecorate/fonts/__init__.py
@@ -1 +0,0 @@
# Need this directory to be a module so that pkg_resources.resource_filename properly finds it
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -57,7 +57,7 @@
packages=["pydecorate"],
include_package_data=True,
package_data={"pydecorate": ["fonts/*.ttf"]},
install_requires=["pillow", "aggdraw", "numpy", "setuptools"],
install_requires=["pillow", "aggdraw", "numpy"],
setup_requires=["setuptools_scm", "setuptools_scm_git_archive"],
scripts=[],
data_files=[],
Expand Down

0 comments on commit be94dbf

Please sign in to comment.