Skip to content

Commit

Permalink
fix(gif): add support for finding the default font on Ubuntu
Browse files Browse the repository at this point in the history
Also print out a message in case of the failure.
  • Loading branch information
mostaphaRoudsari committed Mar 26, 2023
1 parent 8f7f43e commit ec931bb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion honeybee_vtk/image_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,13 @@ def _annotate_image(image: Image.Image, text: str, text_height: int):
try:
fnt = ImageFont.truetype('arial.ttf', text_height)
except OSError:
fnt = ImageFont.load_default()
try:
# ubuntu
fnt = ImageFont.truetype('DejaVuSans.ttf', text_height)
except OSError:
# load a default font
print('Failed to find the font. Loading the default font.')
fnt = ImageFont.load_default()

padding = 5
x_1 = width - (6.5 * text_height)
Expand Down

0 comments on commit ec931bb

Please sign in to comment.