From 97941ad7a5ea4903be8bbe6bf1b4b4c84ca4de9f Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Wed, 1 Apr 2020 18:31:47 +0100 Subject: [PATCH] cu2qu: restore sub-package folder --- Lib/fontTools/cu2qu/__init__.py | 15 +++++++++++++++ Lib/fontTools/{ => cu2qu}/cu2qu.py | 13 ++----------- Lib/fontTools/cu2qu/errors.py | 23 +++++++++++++++++++++++ 3 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 Lib/fontTools/cu2qu/__init__.py rename Lib/fontTools/{ => cu2qu}/cu2qu.py (97%) create mode 100644 Lib/fontTools/cu2qu/errors.py diff --git a/Lib/fontTools/cu2qu/__init__.py b/Lib/fontTools/cu2qu/__init__.py new file mode 100644 index 000000000..4ae6356e4 --- /dev/null +++ b/Lib/fontTools/cu2qu/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .cu2qu import * diff --git a/Lib/fontTools/cu2qu.py b/Lib/fontTools/cu2qu/cu2qu.py similarity index 97% rename from Lib/fontTools/cu2qu.py rename to Lib/fontTools/cu2qu/cu2qu.py index 4710f3c6f..1fdd5e248 100644 --- a/Lib/fontTools/cu2qu.py +++ b/Lib/fontTools/cu2qu/cu2qu.py @@ -23,6 +23,8 @@ except ImportError: import math +from .errors import Error as Cu2QuError, ApproxNotFoundError + __all__ = ['curve_to_quadratic', 'curves_to_quadratic'] @@ -39,17 +41,6 @@ else: COMPILED = False -class Cu2QuError(Exception): - """Base Cu2Qu exception class for all other errors.""" - - -class ApproxNotFoundError(Cu2QuError): - def __init__(self, curve): - message = "no approximation found: %s" % curve - super(Cu2QuError, self).__init__(message) - self.curve = curve - - @cython.cfunc @cython.inline @cython.returns(cython.double) diff --git a/Lib/fontTools/cu2qu/errors.py b/Lib/fontTools/cu2qu/errors.py new file mode 100644 index 000000000..de127aba2 --- /dev/null +++ b/Lib/fontTools/cu2qu/errors.py @@ -0,0 +1,23 @@ +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class Error(Exception): + """Base Cu2Qu exception class for all other errors.""" + + +class ApproxNotFoundError(Error): + def __init__(self, curve): + message = "no approximation found: %s" % curve + super(Error, self).__init__(message) + self.curve = curve