Skip to content

Commit a2c3344

Browse files
authored
Merge pull request matplotlib#6725 from tacaswell/tst_otf
TST: add test for CFF / OTF files
2 parents 05d910d + 9b2a886 commit a2c3344

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ addons:
2424
- texlive-xetex
2525
- graphviz
2626
- libgeos-dev
27+
- otf-freefont
2728
# - fonts-humor-sans
2829
# sources:
2930
# - debian-sid

lib/matplotlib/tests/test_font_manager.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import six
66

77
import os
8-
9-
from matplotlib.font_manager import (findfont, FontProperties, get_font)
8+
import os.path
9+
from matplotlib.font_manager import (findfont, FontProperties, get_font,
10+
is_opentype_cff_font, fontManager as fm)
1011
from matplotlib import rc_context
1112

1213

@@ -23,3 +24,15 @@ def test_font_priority():
2324
cmap = font.get_charmap()
2425
assert len(cmap) == 131
2526
assert cmap[8729] == 30
27+
28+
29+
def test_otf():
30+
fname = '/usr/share/fonts/opentype/freefont/FreeMono.otf'
31+
if os.path.exists(fname):
32+
assert is_opentype_cff_font(fname)
33+
34+
otf_files = [f for f in fm.ttffiles if 'otf' in f]
35+
for f in otf_files:
36+
with open(f, 'rb') as fd:
37+
res = fd.read(4) == b'OTTO'
38+
assert res == is_opentype_cff_font(f)

0 commit comments

Comments
 (0)