Skip to content

Commit

Permalink
TST: add test for CFF / OTF files
Browse files Browse the repository at this point in the history
follow up to matplotlib#6714
  • Loading branch information
tacaswell committed Jul 12, 2016
1 parent 03775bb commit 9b2a886
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -24,6 +24,7 @@ addons:
- texlive-xetex
- graphviz
- libgeos-dev
- otf-freefont
# - fonts-humor-sans
# sources:
# - debian-sid
Expand Down
17 changes: 15 additions & 2 deletions lib/matplotlib/tests/test_font_manager.py
Expand Up @@ -5,8 +5,9 @@
import six

import os

from matplotlib.font_manager import (findfont, FontProperties, get_font)
import os.path
from matplotlib.font_manager import (findfont, FontProperties, get_font,
is_opentype_cff_font, fontManager as fm)
from matplotlib import rc_context


Expand All @@ -23,3 +24,15 @@ def test_font_priority():
cmap = font.get_charmap()
assert len(cmap) == 131
assert cmap[8729] == 30


def test_otf():
fname = '/usr/share/fonts/opentype/freefont/FreeMono.otf'
if os.path.exists(fname):
assert is_opentype_cff_font(fname)

otf_files = [f for f in fm.ttffiles if 'otf' in f]
for f in otf_files:
with open(f, 'rb') as fd:
res = fd.read(4) == b'OTTO'
assert res == is_opentype_cff_font(f)

0 comments on commit 9b2a886

Please sign in to comment.