[woff2] replace print with logger
This commit is contained in:
parent
967b994449
commit
6a92ae085b
@ -13,6 +13,10 @@ from fontTools.ttLib.sfnt import (SFNTReader, SFNTWriter, DirectoryEntry,
|
|||||||
WOFFFlavorData, sfntDirectoryFormat, sfntDirectorySize, SFNTDirectoryEntry,
|
WOFFFlavorData, sfntDirectoryFormat, sfntDirectorySize, SFNTDirectoryEntry,
|
||||||
sfntDirectoryEntrySize, calcChecksum)
|
sfntDirectoryEntrySize, calcChecksum)
|
||||||
from fontTools.ttLib.tables import ttProgram
|
from fontTools.ttLib.tables import ttProgram
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
haveBrotli = False
|
haveBrotli = False
|
||||||
try:
|
try:
|
||||||
@ -28,8 +32,9 @@ class WOFF2Reader(SFNTReader):
|
|||||||
|
|
||||||
def __init__(self, file, checkChecksums=1, fontNumber=-1):
|
def __init__(self, file, checkChecksums=1, fontNumber=-1):
|
||||||
if not haveBrotli:
|
if not haveBrotli:
|
||||||
print('The WOFF2 decoder requires the Brotli Python extension, available at:\n'
|
log.error(
|
||||||
'https://github.com/google/brotli', file=sys.stderr)
|
'The WOFF2 decoder requires the Brotli Python extension, available at: '
|
||||||
|
'https://github.com/google/brotli')
|
||||||
raise ImportError("No module named brotli")
|
raise ImportError("No module named brotli")
|
||||||
|
|
||||||
self.file = file
|
self.file = file
|
||||||
@ -133,8 +138,9 @@ class WOFF2Writer(SFNTWriter):
|
|||||||
def __init__(self, file, numTables, sfntVersion="\000\001\000\000",
|
def __init__(self, file, numTables, sfntVersion="\000\001\000\000",
|
||||||
flavor=None, flavorData=None):
|
flavor=None, flavorData=None):
|
||||||
if not haveBrotli:
|
if not haveBrotli:
|
||||||
print('The WOFF2 encoder requires the Brotli Python extension, available at:\n'
|
log.error(
|
||||||
'https://github.com/google/brotli', file=sys.stderr)
|
'The WOFF2 encoder requires the Brotli Python extension, available at: '
|
||||||
|
'https://github.com/google/brotli')
|
||||||
raise ImportError("No module named brotli")
|
raise ImportError("No module named brotli")
|
||||||
|
|
||||||
self.file = file
|
self.file = file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user