Skip to content

Commit

Permalink
update circleci, travis, better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Jan 8, 2018
1 parent 416e356 commit 4027e0d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
wget https://github.com/jgm/pandoc/releases/download/1.19.2.1/pandoc-1.19.2.1-1-amd64.deb
sudo dpkg -i pandoc-1.19.2.1-1-amd64.deb
- run:
name: Install freetype
command: |
sudo apt-get install -y freetype
- run:
name: Install tex
command: |
Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ addons:
- ffmpeg
- gfortran
- libhdf5-serial-dev
- liblapack-dev
- liblapack-dev
- freetype
install:
# We do this conditionally because it saves us some downloading if the
# version is the same.
Expand Down
12 changes: 11 additions & 1 deletion src/code_beatrix/faq/faq_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
from skimage.transform import rescale


class FontError(Exception):
"""
Raised when a font cannot be found.
"""
pass


##########
# youtube
##########
Expand Down Expand Up @@ -626,7 +633,10 @@ def video_text(text, font=None, fontsize=32, size=None,
font = "arial.ttf"
else:
font = "fnt/arial.ttf"
obj = ImageFont.truetype(font=font, size=fontsize)
try:
obj = ImageFont.truetype(font=font, size=fontsize)
except OSError as e:
raise FontError("Unable to find font '{0}'".format(font)) from e
if size is None:
size = obj.getsize(text)
elif isinstance(size, (float, int)):
Expand Down

0 comments on commit 4027e0d

Please sign in to comment.