signature stringlengths 8 3.44k | body stringlengths 0 1.41M | docstring stringlengths 1 122k | id stringlengths 5 17 |
|---|---|---|---|
def _set_scale(self, value): | sx, sxy, syx, sy, ox, oy = self.transformation<EOL>sx, sy = value<EOL>self.transformation = (sx, sxy, syx, sy, ox, oy)<EOL> | Subclasses may override this method. | f10842:c0:m17 |
def _get_color(self): | self.raiseNotImplementedError()<EOL> | Return the color value as a color tuple or None.
Subclasses must override this method. | f10842:c0:m20 |
def _set_color(self, value): | self.raiseNotImplementedError()<EOL> | value will be a color tuple or None.
Subclasses must override this method. | f10842:c0:m21 |
def _get_data(self): | self.raiseNotImplementedError()<EOL> | This must return raw byte data.
Subclasses must override this method. | f10842:c0:m24 |
def _set_data(self, value): | self.raiseNotImplementedError()<EOL> | value will be raw byte data.
Subclasses must override this method. | f10842:c0:m25 |
def _transformBy(self, matrix, **kwargs): | t = transform.Transform(*matrix)<EOL>transformation = t.transform(self.transformation)<EOL>self.transformation = tuple(transformation)<EOL> | Subclasses may override this method. | f10842:c0:m26 |
def round(self): | self._round()<EOL> | Round offset coordinates. | f10842:c0:m27 |
def _round(self): | x, y = self.offset<EOL>x = normalizers.normalizeRounding(x)<EOL>y = normalizers.normalizeRounding(y)<EOL>self.offset = (x, y)<EOL> | Subclasses may override this method. | f10842:c0:m28 |
def remove(self, key): | del self[key]<EOL> | Removes a key from the Lib. **key** will be
a :ref:`type-string` that is the key to
be removed.
This is a backwards compatibility method. | f10844:c0:m6 |
def asDict(self): | d = {}<EOL>for k, v in self.items():<EOL><INDENT>d[k] = v<EOL><DEDENT>return d<EOL> | Return the Lib as a ``dict``.
This is a backwards compatibility method. | f10844:c0:m7 |
def __contains__(self, key): | return super(BaseLib, self).__contains__(key)<EOL> | Tests to see if a lib name is in the Lib.
**key** will be a :ref:`type-string`.
This returns a ``bool`` indicating if the **key**
is in the Lib. ::
>>> "public.glyphOrder" in font.lib
True | f10844:c0:m8 |
def __delitem__(self, key): | super(BaseLib, self).__delitem__(key)<EOL> | Removes **key** from the Lib. **key** is a :ref:`type-string`.::
>>> del font.lib["public.glyphOrder"] | f10844:c0:m9 |
def __getitem__(self, key): | return super(BaseLib, self).__getitem__(key)<EOL> | Returns the contents of the named lib. **key** is a
:ref:`type-string`.
The returned value will be a ``list`` of the lib contents.::
>>> font.lib["public.glyphOrder"]
["A", "B", "C"]
It is important to understand that any changes to the returned lib
contents will not be reflected in the Lib object. If one wan... | f10844:c0:m10 |
def __iter__(self): | return super(BaseLib, self).__iter__()<EOL> | Iterates through the Lib, giving the key for each iteration. The
order that the Lib will iterate though is not fixed nor is it
ordered.::
>>> for key in font.lib:
>>> print key
"public.glyphOrder"
"org.robofab.scripts.SomeData"
"public.postscriptNames" | f10844:c0:m11 |
def __len__(self): | return super(BaseLib, self).__len__()<EOL> | Returns the number of keys in Lib as an ``int``.::
>>> len(font.lib)
5 | f10844:c0:m12 |
def __setitem__(self, key, items): | super(BaseLib, self).__setitem__(key, items)<EOL> | Sets the **key** to the list of **items**. **key**
is the lib name as a :ref:`type-string` and **items** is a
``list`` of items as :ref:`type-string`.
>>> font.lib["public.glyphOrder"] = ["A", "B", "C"] | f10844:c0:m13 |
def clear(self): | super(BaseLib, self).clear()<EOL> | Removes all keys from Lib,
resetting the Lib to an empty dictionary. ::
>>> font.lib.clear() | f10844:c0:m14 |
def get(self, key, default=None): | return super(BaseLib, self).get(key, default)<EOL> | Returns the contents of the named key.
**key** is a :ref:`type-string`, and the returned values will
either be ``list`` of key contents or ``None`` if no key was
found. ::
>>> font.lib["public.glyphOrder"]
["A", "B", "C"]
It is important to understand that any changes to the returned key
contents will not be ... | f10844:c0:m15 |
def items(self): | return super(BaseLib, self).items()<EOL> | Returns a list of ``tuple`` of each key name and key items.
Keys are :ref:`type-string` and key members are a ``list``
of :ref:`type-string`. The initial list will be unordered.
>>> font.lib.items()
[("public.glyphOrder", ["A", "B", "C"]),
("public.postscriptNames", {'be': 'uni0431', 'ze': 'uni0437'})] | f10844:c0:m16 |
def keys(self): | return super(BaseLib, self).keys()<EOL> | Returns a ``list`` of all the key names in Lib. This list will be
unordered.::
>>> font.lib.keys()
["public.glyphOrder", "org.robofab.scripts.SomeData",
"public.postscriptNames"] | f10844:c0:m17 |
def pop(self, key, default=None): | return super(BaseLib, self).pop(key, default)<EOL> | Removes the **key** from the Lib and returns the ``list`` of
key members. If no key is found, **default** is returned.
**key** is a :ref:`type-string`. This must return either
**default** or a ``list`` of items as :ref:`type-string`.
>>> font.lib.pop("public.glyphOrder")
["A", "B", "C"] | f10844:c0:m18 |
def update(self, otherLib): | super(BaseLib, self).update(otherLib)<EOL> | Updates the Lib based on **otherLib**. *otherLib** is a
``dict`` of keys. If a key from **otherLib** is in Lib
the key members will be replaced by the key members from
**otherLib**. If a key from **otherLib** is not in the Lib,
it is added to the Lib. If Lib contain a key name that is not
in *otherLib**, it is not chan... | f10844:c0:m19 |
def values(self): | return super(BaseLib, self).values()<EOL> | Returns a ``list`` of each named key's members. This will be a list
of lists, the key members will be a ``list`` of :ref:`type-string`.
The initial list will be unordered.
>>> font.lib.items()
[["A", "B", "C"], {'be': 'uni0431', 'ze': 'uni0437'}] | f10844:c0:m20 |
def _get_type(self): | self.raiseNotImplementedError()<EOL> | This is the environment implementation
of :attr:`BasePoint.type`. This must
return a :ref:`type-string` defining
the point type.
Subclasses must override this method. | f10845:c0:m8 |
def _set_type(self, value): | self.raiseNotImplementedError()<EOL> | This is the environment implementation
of :attr:`BasePoint.type`. **value**
will be a :ref:`type-string` defining
the point type. It will have been normalized
with :func:`normalizers.normalizePointType`.
Subclasses must override this method. | f10845:c0:m9 |
def _get_smooth(self): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BasePoint.smooth`. This must return
a ``bool`` indicating the smooth state.
Subclasses must override this method. | f10845:c0:m12 |
def _set_smooth(self, value): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BasePoint.smooth`. **value** will
be a ``bool`` indicating the smooth state.
It will have been normalized with
:func:`normalizers.normalizeBoolean`.
Subclasses must override this method. | f10845:c0:m13 |
def _get_x(self): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BasePoint.x`. This must return an
:ref:`type-int-float`.
Subclasses must override this method. | f10845:c0:m16 |
def _set_x(self, value): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BasePoint.x`. **value** will be
an :ref:`type-int-float`.
Subclasses must override this method. | f10845:c0:m17 |
def _get_y(self): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BasePoint.y`. This must return an
:ref:`type-int-float`.
Subclasses must override this method. | f10845:c0:m20 |
def _set_y(self, value): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BasePoint.y`. **value** will be
an :ref:`type-int-float`.
Subclasses must override this method. | f10845:c0:m21 |
def _get_index(self): | contour = self.contour<EOL>if contour is None:<EOL><INDENT>return None<EOL><DEDENT>return contour.points.index(self)<EOL> | Get the point's index.
This must return an ``int``.
Subclasses may override this method. | f10845:c0:m23 |
def _get_name(self): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BasePoint.name`. This must return a
:ref:`type-string` or ``None``. The returned
value will be normalized with
:func:`normalizers.normalizePointName`.
Subclasses must override this method. | f10845:c0:m26 |
def _set_name(self, value): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BasePoint.name`. **value** will be
a :ref:`type-string` or ``None``. It will
have been normalized with
:func:`normalizers.normalizePointName`.
Subclasses must override this method. | f10845:c0:m27 |
def _transformBy(self, matrix, **kwargs): | t = transform.Transform(*matrix)<EOL>x, y = t.transformPoint((self.x, self.y))<EOL>self.x = x<EOL>self.y = y<EOL> | This is the environment implementation of
:meth:`BasePoint.transformBy`.
**matrix** will be a :ref:`type-transformation`.
that has been normalized with
:func:`normalizers.normalizeTransformationMatrix`.
Subclasses may override this method. | f10845:c0:m28 |
def round(self): | self._round()<EOL> | Round the point's coordinate.
>>> point.round()
This applies to the following:
* x
* y | f10845:c0:m29 |
def _round(self, **kwargs): | self.x = normalizers.normalizeRounding(self.x)<EOL>self.y = normalizers.normalizeRounding(self.y)<EOL> | This is the environment implementation of
:meth:`BasePoint.round`.
Subclasses may override this method. | f10845:c0:m30 |
def _getAttr(self, attr): | meth = "<STR_LIT>" % attr<EOL>if not hasattr(self, meth):<EOL><INDENT>raise AttributeError("<STR_LIT>" % attr)<EOL><DEDENT>meth = getattr(self, meth)<EOL>value = meth()<EOL>return value<EOL> | Subclasses may override this method.
If a subclass does not override this method,
it must implement '_get_attributeName' methods
for all Info methods. | f10846:c0:m6 |
def _setAttr(self, attr, value): | meth = "<STR_LIT>" % attr<EOL>if not hasattr(self, meth):<EOL><INDENT>raise AttributeError("<STR_LIT>" % attr)<EOL><DEDENT>meth = getattr(self, meth)<EOL>meth(value)<EOL> | Subclasses may override this method.
If a subclass does not override this method,
it must implement '_set_attributeName' methods
for all Info methods. | f10846:c0:m8 |
def round(self): | self._round()<EOL> | Round the following attributes to integers:
- unitsPerEm
- descender
- xHeight
- capHeight
- ascender
- openTypeHeadLowestRecPPEM
- openTypeHheaAscender
- openTypeHheaDescender
- openTypeHheaLineGap
- openTypeHheaCaretSlopeRise
- openTypeHheaCaretSlopeRun
- openTypeHheaCaretOffset
- openTypeOS2WidthClass
- openTypeOS2... | f10846:c0:m9 |
def _round(self, **kwargs): | mathInfo = self._toMathInfo(guidelines=False)<EOL>mathInfo = mathInfo.round()<EOL>self._fromMathInfo(mathInfo, guidelines=False)<EOL> | Subclasses may override this method. | f10846:c0:m10 |
def toMathInfo(self, guidelines=True): | return self._toMathInfo(guidelines=guidelines)<EOL> | Returns the info as an object that follows the
`MathGlyph protocol <https://github.com/typesupply/fontMath>`_.
>>> mg = font.info.toMathInfo() | f10846:c0:m11 |
def fromMathInfo(self, mathInfo, guidelines=True): | return self._fromMathInfo(mathInfo, guidelines=guidelines)<EOL> | Replaces the contents of this info object with the contents of ``mathInfo``.
>>> font.fromMathInfo(mg)
``mathInfo`` must be an object following the
`MathInfo protocol <https://github.com/typesupply/fontMath>`_. | f10846:c0:m12 |
def _toMathInfo(self, guidelines=True): | import fontMath<EOL>self.guidelines = []<EOL>if guidelines:<EOL><INDENT>for guideline in self.font.guidelines:<EOL><INDENT>d = dict(<EOL>x=guideline.x,<EOL>y=guideline.y,<EOL>angle=guideline.angle,<EOL>name=guideline.name,<EOL>identifier=guideline.identifier,<EOL>color=guideline.color<EOL>)<EOL>self.guidelines.append(d... | Subclasses may override this method. | f10846:c0:m13 |
def _fromMathInfo(self, mathInfo, guidelines=True): | self.guidelines = []<EOL>mathInfo.extractInfo(self)<EOL>font = self.font<EOL>if guidelines:<EOL><INDENT>for guideline in self.guidelines:<EOL><INDENT>font.appendGuideline(<EOL>position=(guideline["<STR_LIT:x>"], guideline["<STR_LIT:y>"]),<EOL>angle=guideline["<STR_LIT>"],<EOL>name=guideline["<STR_LIT:name>"],<EOL>color... | Subclasses may override this method. | f10846:c0:m14 |
def interpolate(self, factor, minInfo, maxInfo, round=True, suppressError=True): | factor = normalizers.normalizeInterpolationFactor(factor)<EOL>if not isinstance(minInfo, BaseInfo):<EOL><INDENT>raise TypeError(("<STR_LIT>"<EOL>"<STR_LIT>") %<EOL>(self.__class__.__name__, minInfo.__class__.__name__))<EOL><DEDENT>if not isinstance(maxInfo, BaseInfo):<EOL><INDENT>raise TypeError(("<STR_LIT>"<EOL>"<STR_... | Interpolate all pairs between minInfo and maxInfo.
The interpolation occurs on a 0 to 1.0 range where minInfo
is located at 0 and maxInfo is located at 1.0.
factor is the interpolation value. It may be less than 0
and greater than 1.0. It may be a number (integer, float)
or a tuple of two numbers. If it is a tuple, th... | f10846:c0:m15 |
def _interpolate(self, factor, minInfo, maxInfo, round=True, suppressError=True): | minInfo = minInfo._toMathInfo()<EOL>maxInfo = maxInfo._toMathInfo()<EOL>result = interpolate(minInfo, maxInfo, factor)<EOL>if result is None and not suppressError:<EOL><INDENT>raise FontPartsError(("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>% (minInfo.font.name, maxInfo.font.name))<EOL><DEDENT>if round:<EOL><INDENT>result = resu... | Subclasses may override this method. | f10846:c0:m16 |
def _init(self, *args, **kwargs): | pass<EOL> | Subclasses may override this method. | f10847:c1:m1 |
@classmethod<EOL><INDENT>def _reprContents(cls):<DEDENT> | return []<EOL> | Subclasses may override this method to
provide a list of strings for inclusion
in ``__repr__``. If so, they should call
``super`` and append their additions
to the returned ``list``. | f10847:c1:m3 |
def __eq__(self, other): | if isinstance(other, self.__class__):<EOL><INDENT>return self.naked() is other.naked()<EOL><DEDENT>return NotImplemented<EOL> | Subclasses may override this method. | f10847:c1:m4 |
def __ne__(self, other): | equal = self.__eq__(other)<EOL>return NotImplemented if equal is NotImplemented else not equal<EOL> | Subclasses must not override this method. | f10847:c1:m5 |
def __hash__(self): | return id(self.naked())<EOL> | Allow subclasses to be used in hashable collections.
Subclasses may override this method. | f10847:c1:m6 |
def copy(self): | copyClass = self.copyClass<EOL>if copyClass is None:<EOL><INDENT>copyClass = self.__class__<EOL><DEDENT>copied = copyClass()<EOL>copied.copyData(self)<EOL>return copied<EOL> | Copy this object into a new object of the same type.
The returned object will not have a parent object. | f10847:c1:m7 |
def copyData(self, source): | for attr in self.copyAttributes:<EOL><INDENT>selfValue = getattr(self, attr)<EOL>sourceValue = getattr(source, attr)<EOL>if isinstance(selfValue, BaseObject):<EOL><INDENT>selfValue.copyData(sourceValue)<EOL><DEDENT>else:<EOL><INDENT>setattr(self, attr, sourceValue)<EOL><DEDENT><DEDENT> | Subclasses may override this method.
If so, they should call the super. | f10847:c1:m8 |
def raiseNotImplementedError(self): | raise NotImplementedError(<EOL>"<STR_LIT>"<EOL>.format(className=self.__class__.__name__)<EOL>)<EOL> | This exception needs to be raised frequently by
the base classes. So, it's here for convenience. | f10847:c1:m9 |
def changed(self, *args, **kwargs): | Tell the environment that something has changed in
the object. The behavior of this method will vary
from environment to environment.
>>> obj.changed() | f10847:c1:m10 | |
def naked(self): | self.raiseNotImplementedError()<EOL> | Return the environment's native object
that has been wrapped by this object.
>>> loweLevelObj = obj.naked() | f10847:c1:m11 |
def _len(self): | return len(self.keys())<EOL> | Subclasses may override this method. | f10847:c2:m2 |
def _keys(self): | return [k for k, v in self.items()]<EOL> | Subclasses may override this method. | f10847:c2:m4 |
def _items(self): | self.raiseNotImplementedError()<EOL> | Subclasses must override this method. | f10847:c2:m6 |
def _values(self): | return [v for k, v in self.items()]<EOL> | Subclasses may override this method. | f10847:c2:m8 |
def _contains(self, key): | self.raiseNotImplementedError()<EOL> | Subclasses must override this method. | f10847:c2:m10 |
def _setItem(self, key, value): | self.raiseNotImplementedError()<EOL> | Subclasses must override this method. | f10847:c2:m12 |
def _getItem(self, key): | self.raiseNotImplementedError()<EOL> | Subclasses must override this method. | f10847:c2:m14 |
def _get(self, key, default=None): | if key in self:<EOL><INDENT>return self[key]<EOL><DEDENT>return default<EOL> | Subclasses may override this method. | f10847:c2:m16 |
def _delItem(self, key): | self.raiseNotImplementedError()<EOL> | Subclasses must override this method. | f10847:c2:m18 |
def _pop(self, key, default=None): | value = default<EOL>if key in self:<EOL><INDENT>value = self[key]<EOL>del self[key]<EOL><DEDENT>return value<EOL> | Subclasses may override this method. | f10847:c2:m20 |
def _iter(self): | keys = self.keys()<EOL>while keys:<EOL><INDENT>key = keys[<NUM_LIT:0>]<EOL>yield key<EOL>keys = keys[<NUM_LIT:1>:]<EOL><DEDENT> | Subclasses may override this method. | f10847:c2:m22 |
def _update(self, other): | for key, value in other.items():<EOL><INDENT>self[key] = value<EOL><DEDENT> | Subclasses may override this method. | f10847:c2:m24 |
def _clear(self): | for key in self.keys():<EOL><INDENT>del self[key]<EOL><DEDENT> | Subclasses may override this method. | f10847:c2:m26 |
def transformBy(self, matrix, origin=None): | matrix = normalizers.normalizeTransformationMatrix(matrix)<EOL>if origin is None:<EOL><INDENT>origin = (<NUM_LIT:0>, <NUM_LIT:0>)<EOL><DEDENT>origin = normalizers.normalizeCoordinateTuple(origin)<EOL>if origin is not None:<EOL><INDENT>t = transform.Transform()<EOL>oX, oY = origin<EOL>t = t.translate(oX, oY)<EOL>t = t.t... | Transform the object.
>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0))
>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0), origin=(500, 500))
**matrix** must be a :ref:`type-transformation`.
**origin** defines the point at with the transformation
should originate. It must be a :ref:`type-coordinate`
or ``None``. The def... | f10847:c3:m0 |
def _transformBy(self, matrix, **kwargs): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:meth:`BaseObject.transformBy`.
**matrix** will be a :ref:`type-transformation`.
that has been normalized with
:func:`normalizers.normalizeTransformationMatrix`.
Subclasses must override this method. | f10847:c3:m1 |
def moveBy(self, value): | value = normalizers.normalizeTransformationOffset(value)<EOL>self._moveBy(value)<EOL> | Move the object.
>>> obj.transformBy((10, 0))
**value** must be an iterable containing two
:ref:`type-int-float` values defining the x and y
values to move the object by. | f10847:c3:m2 |
def _moveBy(self, value, **kwargs): | x, y = value<EOL>t = transform.Offset(x, y)<EOL>self.transformBy(tuple(t), **kwargs)<EOL> | This is the environment implementation of
:meth:`BaseObject.moveBy`.
**value** will be an iterable containing two
:ref:`type-int-float` values defining the x and y
values to move the object by. It will have been
normalized with :func:`normalizers.normalizeTransformationOffset`.
Subclasses may override this method. | f10847:c3:m3 |
def scaleBy(self, value, origin=None): | value = normalizers.normalizeTransformationScale(value)<EOL>if origin is None:<EOL><INDENT>origin = (<NUM_LIT:0>, <NUM_LIT:0>)<EOL><DEDENT>origin = normalizers.normalizeCoordinateTuple(origin)<EOL>self._scaleBy(value, origin=origin)<EOL> | Scale the object.
>>> obj.transformBy(2.0)
>>> obj.transformBy((0.5, 2.0), origin=(500, 500))
**value** must be an iterable containing two
:ref:`type-int-float` values defining the x and y
values to scale the object by. **origin** defines the
point at with the scale should originate. It must be
a :ref:`type-c... | f10847:c3:m4 |
def _scaleBy(self, value, origin=None, **kwargs): | x, y = value<EOL>t = transform.Identity.scale(x=x, y=y)<EOL>self.transformBy(tuple(t), origin=origin, **kwargs)<EOL> | This is the environment implementation of
:meth:`BaseObject.scaleBy`.
**value** will be an iterable containing two
:ref:`type-int-float` values defining the x and y
values to scale the object by. It will have been
normalized with :func:`normalizers.normalizeTransformationScale`.
**origin** will be a :ref:`type-coordin... | f10847:c3:m5 |
def rotateBy(self, value, origin=None): | value = normalizers.normalizeRotationAngle(value)<EOL>if origin is None:<EOL><INDENT>origin = (<NUM_LIT:0>, <NUM_LIT:0>)<EOL><DEDENT>origin = normalizers.normalizeCoordinateTuple(origin)<EOL>self._rotateBy(value, origin=origin)<EOL> | Rotate the object.
>>> obj.transformBy(45)
>>> obj.transformBy(45, origin=(500, 500))
**value** must be a :ref:`type-int-float` values
defining the angle to rotate the object by. **origin**
defines the point at with the rotation should originate.
It must be a :ref:`type-coordinate` or ``None``.
The default is... | f10847:c3:m6 |
def _rotateBy(self, value, origin=None, **kwargs): | a = math.radians(value)<EOL>t = transform.Identity.rotate(a)<EOL>self.transformBy(tuple(t), origin=origin, **kwargs)<EOL> | This is the environment implementation of
:meth:`BaseObject.rotateBy`.
**value** will be a :ref:`type-int-float` value
defining the value to rotate the object by.
It will have been normalized with
:func:`normalizers.normalizeRotationAngle`.
**origin** will be a :ref:`type-coordinate` defining
the point at which the ro... | f10847:c3:m7 |
def skewBy(self, value, origin=None): | value = normalizers.normalizeTransformationSkewAngle(value)<EOL>if origin is None:<EOL><INDENT>origin = (<NUM_LIT:0>, <NUM_LIT:0>)<EOL><DEDENT>origin = normalizers.normalizeCoordinateTuple(origin)<EOL>self._skewBy(value, origin=origin)<EOL> | Skew the object.
>>> obj.skewBy(11)
>>> obj.skewBy((25, 10), origin=(500, 500))
**value** must be rone of the following:
* single :ref:`type-int-float` indicating the
value to skew the x direction by.
* iterable cointaining type :ref:`type-int-float`
defining the values to skew the x and y directions by.... | f10847:c3:m8 |
def _skewBy(self, value, origin=None, **kwargs): | x, y = value<EOL>x = math.radians(x)<EOL>y = math.radians(y)<EOL>t = transform.Identity.skew(x=x, y=y)<EOL>self.transformBy(tuple(t), origin=origin, **kwargs)<EOL> | This is the environment implementation of
:meth:`BaseObject.skewBy`.
**value** will be an iterable containing two
:ref:`type-int-float` values defining the x and y
values to skew the object by. It will have been
normalized with :func:`normalizers.normalizeTransformationSkewAngle`.
**origin** will be a :ref:`type-coord... | f10847:c3:m9 |
def isCompatible(self, other, cls): | if not isinstance(other, cls):<EOL><INDENT>raise TypeError(<EOL>"""<STR_LIT>"""<EOL>% (cls.__name__, other.__class__.__name__))<EOL><DEDENT>reporter = self.compatibilityReporterClass(self, other)<EOL>self._isCompatible(other, reporter)<EOL>return not reporter.fatal, reporter<EOL> | Evaluate interpolation compatibility with other. | f10847:c4:m0 |
def _isCompatible(self, other, reporter): | self.raiseNotImplementedError()<EOL> | Subclasses must override this method. | f10847:c4:m1 |
def _get_selected(self): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BaseObject.selected`. This must return a
**boolean** representing the selection state
of the object. The value will be normalized
with :func:`normalizers.normalizeBoolean`.
Subclasses must override this method if they
implement object selection. | f10847:c5:m2 |
def _set_selected(self, value): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BaseObject.selected`. **value** will
be a **boolean** representing the object's
selection state. The value will have been
normalized with :func:`normalizers.normalizeBoolean`.
Subclasses must override this method if they
implement object selection. | f10847:c5:m3 |
def _get_position(self): | return (self.x, self.y)<EOL> | Subclasses may override this method. | f10847:c6:m2 |
def _set_position(self, value): | pX, pY = self.position<EOL>x, y = value<EOL>dX = x - pX<EOL>dY = y - pY<EOL>self.moveBy((dX, dY))<EOL> | Subclasses may override this method. | f10847:c6:m3 |
def _get_identifier(self): | self.raiseNotImplementedError()<EOL> | This is the environment implementation of
:attr:`BaseObject.identifier`. This must
return an :ref:`type-identifier`. If
the native object does not have an identifier
assigned one should be assigned and returned.
Subclasses must override this method. | f10847:c7:m1 |
def getIdentifier(self): | return self._getIdentifier()<EOL> | Create a new, unique identifier for and assign it to the object.
If the object already has an identifier, the existing one should
be returned. | f10847:c7:m2 |
def _getIdentifier(self): | self.raiseNotImplementedError()<EOL> | Subclasses must override this method. | f10847:c7:m3 |
def _setIdentifier(self, value): | pass<EOL> | This method is used internally to force a specific
identifier onto an object in certain situations.
Subclasses that allow setting an identifier to a
specific value may override this method. | f10847:c7:m4 |
def _get_index(self): | glyph = self.glyph<EOL>return glyph.contours.index(self)<EOL> | Subclasses may override this method. | f10848:c0:m8 |
def _set_index(self, value): | self.raiseNotImplementedError()<EOL> | Subclasses must override this method. | f10848:c0:m9 |
def getIdentifierForPoint(self, point): | point = normalizers.normalizePoint(point)<EOL>return self._getIdentifierforPoint(point)<EOL> | Create a unique identifier for and assign it to ``point``.
If the point already has an identifier, the existing
identifier will be returned.
>>> contour.getIdentifierForPoint(point)
'ILHGJlygfds'
``point`` must be a :class:`BasePoint`. The returned value
will be a :ref:`type-identifier`. | f10848:c0:m10 |
def _getIdentifierforPoint(self, point): | self.raiseNotImplementedError()<EOL> | Subclasses must override this method. | f10848:c0:m11 |
def draw(self, pen): | self._draw(pen)<EOL> | Draw the contour's outline data to the given :ref:`type-pen`.
>>> contour.draw(pen) | f10848:c0:m12 |
def _draw(self, pen, **kwargs): | from fontTools.ufoLib.pointPen import PointToSegmentPen<EOL>adapter = PointToSegmentPen(pen)<EOL>self.drawPoints(adapter)<EOL> | Subclasses may override this method. | f10848:c0:m13 |
def drawPoints(self, pen): | self._drawPoints(pen)<EOL> | Draw the contour's outline data to the given :ref:`type-point-pen`.
>>> contour.drawPoints(pointPen) | f10848:c0:m14 |
def _drawPoints(self, pen, **kwargs): | <EOL>try:<EOL><INDENT>pen.beginPath(self.identifier)<EOL><DEDENT>except TypeError:<EOL><INDENT>pen.beginPath()<EOL><DEDENT>for point in self.points:<EOL><INDENT>typ = point.type<EOL>if typ == "<STR_LIT>":<EOL><INDENT>typ = None<EOL><DEDENT>try:<EOL><INDENT>pen.addPoint(pt=(point.x, point.y), segmentType=typ,<EOL>smooth... | Subclasses may override this method. | f10848:c0:m15 |
def autoStartSegment(self): | self._autoStartSegment()<EOL> | Automatically calculate and set the first segment
in this contour.
The behavior of this may vary accross environments. | f10848:c0:m16 |
def _autoStartSegment(self, **kwargs): | self.raiseNotImplementedError()<EOL> | Subclasses may override this method.
XXX port this from robofab | f10848:c0:m17 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.