From 61670fc652c9fa0ea090ac9c06f62fa20dcea165 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 24 May 2017 10:00:55 +0200 Subject: [PATCH] Use logging module for these warnings Not sure if warnings module was used intentionally here, but the messages looked odd compared to other FontTools messages. --- Lib/fontTools/mtiLib/__init__.py | 3 +-- Lib/fontTools/varLib/__init__.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Lib/fontTools/mtiLib/__init__.py b/Lib/fontTools/mtiLib/__init__.py index ad9d2b863..a8a0d5533 100644 --- a/Lib/fontTools/mtiLib/__init__.py +++ b/Lib/fontTools/mtiLib/__init__.py @@ -17,7 +17,6 @@ from fontTools.otlLib import builder as otl from contextlib import contextmanager from operator import setitem import logging -import warnings class MtiLibError(Exception): pass class ReferenceNotFoundError(MtiLibError): pass @@ -1074,7 +1073,7 @@ class Tokenizer(object): if len(line) == 1 and not line[0]: del line[0] if line and not line[-1]: - warnings.warn('trailing tab found on line %d: %s' % (self.lineno, self.line)) + log.warn('trailing tab found on line %d: %s' % (self.lineno, self.line)) while line and not line[-1]: del line[-1] return line diff --git a/Lib/fontTools/varLib/__init__.py b/Lib/fontTools/varLib/__init__.py index 530fd0f01..527d32d69 100644 --- a/Lib/fontTools/varLib/__init__.py +++ b/Lib/fontTools/varLib/__init__.py @@ -30,7 +30,6 @@ from fontTools.ttLib.tables import otTables as ot from fontTools.varLib import builder, designspace, models from fontTools.varLib.merger import VariationMerger, _all_equal from collections import OrderedDict -import warnings import os.path import logging from pprint import pformat @@ -219,7 +218,7 @@ def _add_gvar(font, model, master_ttfs, tolerance=.5): allControls = [d[1] for d in allData] control = allControls[0] if (any(c != control for c in allControls)): - warnings.warn("glyph %s has incompatible masters; skipping" % glyph) + log.warn("glyph %s has incompatible masters; skipping" % glyph) continue del allControls