Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50e06d7

Browse files
committed
TST: add test for CFF / OTF files
follow up to #6714
1 parent 03775bb commit 50e06d7

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-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: 16 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,16 @@ 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+
assert False
34+
35+
otf_files = [f for f in fm.ttffiles if 'otf' in f]
36+
for f in otf_files:
37+
with open(f, 'rb') as fd:
38+
res = fd.read(4) == b'OTTO'
39+
assert res == is_opentype_cff_font(f)

0 commit comments

Comments
 (0)