/usr/bin/check-font-embedding-restrictions is in check-all-the-things 2017.05.20.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #!/usr/bin/python2
import fontforge
import deb822
import sys
import os
# The fontforge module prints warnings to stderr
# but that isn't useful for checking OS/2 fsType
old = os.dup(2)
os.close(2)
os.open(os.devnull, os.O_WRONLY)
try:
with open('debian/control') as f:
for para in deb822.Deb822.iter_paragraphs(f):
if 'Section' in para and para['Section'].startswith('non-free/'):
exit()
except IOError:
exit()
embedding_restricted = set()
for file in set(sys.argv[1:]):
try:
font = fontforge.open(file)
if font:
if 0 != font.os2_fstype:
info = '{}: {:#06x}'.format(file, font.os2_fstype)
embedding_restricted.add(info)
font.close()
except EnvironmentError:
pass
# Restore stderr
os.close(2)
os.dup(old)
os.close(old)
if embedding_restricted:
print 'These fonts in Debian main/contrib have embedding'
print 'restrictions, which are not DFSG compatible:'
print
print '\n'.join(sorted(embedding_restricted))
print
print 'https://www.microsoft.com/typography/otspec/os2.htm#fst'
|