From 3832d51ca7700edb8aeb9412c98d70a5183d5808 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Mon, 3 Jun 2024 10:47:36 +0100 Subject: [PATCH] Always use default load filters on load --- src/babelfont/__main__.py | 2 +- src/babelfont/convertors/__init__.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/babelfont/__main__.py b/src/babelfont/__main__.py index bda9653..7fdd12c 100644 --- a/src/babelfont/__main__.py +++ b/src/babelfont/__main__.py @@ -57,7 +57,7 @@ def main(): try: logger.info("Reading %s", args.input) - font = convertor_in.load(input_job) + font = convertor_in.load(input_job, filters=False) except Exception as e: logger.error("Couldn't read %s: %s", args.input, e) sys.exit(1) diff --git a/src/babelfont/convertors/__init__.py b/src/babelfont/convertors/__init__.py index 5d36e91..548cb75 100644 --- a/src/babelfont/convertors/__init__.py +++ b/src/babelfont/convertors/__init__.py @@ -6,6 +6,7 @@ import logging from babelfont.Font import Font +from babelfont.fontFilters import parse_filter logger = logging.getLogger(__name__) @@ -34,15 +35,20 @@ def can_save(cls, other, **kwargs): return other.filename.endswith(cls.suffix) @classmethod - def load(cls, convertor, compile_only=False): + def load(cls, convertor, compile_only=False, filters=True): self = cls() self.font = Font() # Pass on information to child self.filename = convertor.filename self.scratch = convertor.scratch self.compile_only = compile_only + loaded = self._load() + if filters: + for f in cls.LOAD_FILTERS: + fltr, filterargs = parse_filter(f) + fltr(loaded, filterargs) - return self._load() + return loaded @classmethod def save(cls, obj, convertor, **kwargs):