[transform] Rename VarTransform to DecomposedTransform
This commit is contained in:
parent
96f602cf3c
commit
2e20e47473
@ -401,7 +401,7 @@ def Scale(x, y=None):
|
||||
|
||||
|
||||
@dataclass
|
||||
class VarTransform:
|
||||
class DecomposedTransform:
|
||||
translateX: float = (0,)
|
||||
translateY: float = (0,)
|
||||
rotation: float = (0,) # in degrees, counter-clockwise
|
||||
|
@ -39,7 +39,7 @@ sequence of length 2 will do.
|
||||
from typing import Tuple, Dict
|
||||
|
||||
from fontTools.misc.loggingTools import LogMixin
|
||||
from fontTools.misc.transform import VarTransform
|
||||
from fontTools.misc.transform import DecomposedTransform
|
||||
|
||||
__all__ = [
|
||||
"AbstractPen",
|
||||
@ -135,11 +135,11 @@ class AbstractPen:
|
||||
def addVarComponent(
|
||||
self,
|
||||
glyphName: str,
|
||||
transformation: VarTransform,
|
||||
transformation: DecomposedTransform,
|
||||
location: Dict[str, float],
|
||||
) -> None:
|
||||
"""Add a VarComponent sub glyph. The 'transformation' argument
|
||||
must be a VarTransform from the fontTools.misc.transform module,
|
||||
must be a DecomposedTransform from the fontTools.misc.transform module,
|
||||
and the 'location' argument must be a dictionary mapping axis tags
|
||||
to their locations.
|
||||
"""
|
||||
|
@ -16,7 +16,7 @@ import math
|
||||
from typing import Any, Optional, Tuple, Dict
|
||||
|
||||
from fontTools.pens.basePen import AbstractPen, PenError
|
||||
from fontTools.misc.transform import VarTransform
|
||||
from fontTools.misc.transform import DecomposedTransform
|
||||
|
||||
__all__ = [
|
||||
"AbstractPointPen",
|
||||
@ -64,13 +64,13 @@ class AbstractPointPen:
|
||||
def addVarComponent(
|
||||
self,
|
||||
glyphName: str,
|
||||
transformation: VarTransform,
|
||||
transformation: DecomposedTransform,
|
||||
location: Dict[str, float],
|
||||
identifier: Optional[str] = None,
|
||||
**kwargs: Any,
|
||||
) -> None:
|
||||
"""Add a VarComponent sub glyph. The 'transformation' argument
|
||||
must be a VarTransform from the fontTools.misc.transform module,
|
||||
must be a DecomposedTransform from the fontTools.misc.transform module,
|
||||
and the 'location' argument must be a dictionary mapping axis tags
|
||||
to their locations.
|
||||
"""
|
||||
|
@ -4,7 +4,7 @@ from collections import namedtuple
|
||||
from fontTools.misc import sstruct
|
||||
from fontTools import ttLib
|
||||
from fontTools import version
|
||||
from fontTools.misc.transform import VarTransform
|
||||
from fontTools.misc.transform import DecomposedTransform
|
||||
from fontTools.misc.textTools import tostr, safeEval, pad
|
||||
from fontTools.misc.arrayTools import calcIntBounds, pointInRect
|
||||
from fontTools.misc.bezierTools import calcQuadraticBounds
|
||||
@ -1751,7 +1751,7 @@ VAR_COMPONENT_TRANSFORM_MAPPING = {
|
||||
class GlyphVarComponent(object):
|
||||
def __init__(self):
|
||||
self.location = {}
|
||||
self.transform = VarTransform()
|
||||
self.transform = DecomposedTransform()
|
||||
|
||||
def decompile(self, data, glyfTable):
|
||||
flags = struct.unpack(">H", data[:2])[0]
|
||||
|
@ -2,7 +2,7 @@ from fontTools.ttLib import TTFont
|
||||
from fontTools.ttLib import ttGlyphSet
|
||||
from fontTools.pens.recordingPen import RecordingPen, DecomposingRecordingPen
|
||||
from fontTools.misc.roundTools import otRound
|
||||
from fontTools.misc.transform import VarTransform
|
||||
from fontTools.misc.transform import DecomposedTransform
|
||||
import os
|
||||
import pytest
|
||||
|
||||
@ -174,7 +174,7 @@ class TTGlyphSetTest(object):
|
||||
"addVarComponent",
|
||||
(
|
||||
"glyph00003",
|
||||
VarTransform(460.0, 676.0, 0, 1, 1, 0, 0, 0, 0),
|
||||
DecomposedTransform(460.0, 676.0, 0, 1, 1, 0, 0, 0, 0),
|
||||
{
|
||||
"0000": 0.84661865234375,
|
||||
"0001": 0.98944091796875,
|
||||
@ -187,7 +187,7 @@ class TTGlyphSetTest(object):
|
||||
"addVarComponent",
|
||||
(
|
||||
"glyph00004",
|
||||
VarTransform(932.0, 382.0, 0, 1, 1, 0, 0, 0, 0),
|
||||
DecomposedTransform(932.0, 382.0, 0, 1, 1, 0, 0, 0, 0),
|
||||
{
|
||||
"0000": 0.93359375,
|
||||
"0001": 0.916015625,
|
||||
|
Loading…
x
Reference in New Issue
Block a user