Kerning

Must Override

BaseKerning._contains(key: KeyType) bool

Check if a key is in the native object.

This is the environment implementation of BaseDict.__contains__.

Parameters:

key – The key to check for. If a :cvar:`BaseDict.keyNormalizer` is set, it will have been applied to the key before checking.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseKerning._delItem(key: KeyType) None

Delete a key-value pair from the native object.

This is the environment implementation of BaseDict.__delitem__.

Parameters:

key – The key to delete. If a :cvar:`BaseDict.keyNormalizer` is set, it will have been applied to the given key.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseKerning._getItem(key: KeyType) ValueType

Get the value for a given key from the native object.

This is the environment implementation of BaseDict.__getitem__.

Parameters:

key – The key to retrieve the value for. If a :cvar:`BaseDict.keyNormalizer` is set, it will have been applied to the key in the calling method.

Returns:

The value for the given key. If a :cvar:`BaseDict.valueNormalizer` is set, it will be applied in the calling method to the returned value.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseKerning._items() ItemsView[KeyType, ValueType]

Return a view of the key-value pairs in the native object.

This is the environment implementation of BaseDict.items.

Returns:

A ItemsView object instance. If both :cvar:`BaseDict.keyNormalizer` and :cvar:`BaseDict.valueNormalizer` are set, they will be applied to each key and value in the returned object.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseKerning._setItem(key: KeyType, value: ValueType) None

Set the value for a given key in the native object.

This is the environment implementation of BaseDict.__setitem__.

Parameters:
Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

May Override

BaseKerning._clear() None

Remove all items from the native object.

This is the environment implementation of BaseDict.clear.

Note

Subclasses may override this method.

BaseKerning._get(key: KeyType, default: ValueType | None) ValueType | None

Get the value for a given key in the native object.

This is the environment implementation of BaseDict.get.

Parameters:
  • key – The key to look up. If a :cvar:`BaseDict.keyNormalizer` is set, it will have been applied to the given key.

  • default – The default value to return if the key is not found.

Returns:

The value associated with the given key, or the default value if the key is not found. If a :cvar:`BaseDict.valueNormalizer` is set, it will be applied in the calling method to the returned value.

Note

Subclasses may override this method.

BaseKerning._init(*args: Any, **kwargs: Any) None

Initialize the native object.

This is the environment implementation of BaseObject.__init__.

Parameters:
  • *args – Any positional arguments.

  • **kwargs – Any keyword arguments.

Note

Subclasses may override this method.

BaseKerning._interpolate(factor: list[int | float] | tuple[float, float], minKerning: BaseKerning, maxKerning: BaseKerning, round: bool, suppressError: bool) None[source]

Interpolate all kerning pairs in the native font.

The kerning data will be replaced by the interpolated kerning.

Parameters:
  • factor – The interpolation value as a single int or float or a list or tuple of two int or float values representing the factors (x, y).

  • minKerning – The BaseKerning subclass instance corresponding to the 0.0 position in the interpolation.

  • maxKerning – The BaseKerning subclass instance corresponding to the 1.0 position in the interpolation.

  • round – A bool indicating whether the result should be rounded to integers.

  • suppressError – A bool indicating whether to ignore incompatible data or raise an error when such incompatibilities are found.

Note

Subclasses may override this method.

BaseKerning._iter() Iterator[KeyType]

Return an iterator over the keys of the native object.

This is the environment implementation of BaseDict.__iter__.

Returns:

An iterator over the object’s keys.

Note

Subclasses may override this method.

BaseKerning._keys() BaseKeys[KeyType]

Return a view of the keys in the native object.

This is the environment implementation of BaseDict.keys.

Returns:

A BaseKeys object instance of str items. If a :cvar:`BaseDict.keyNormalizer` is set, it will be applied to each key in the returned view.

Note

Subclasses may override this method.

BaseKerning._len() int

Return the number of items in the native object.

This is the environment implementation of BaseDict.__len__.

Returns:

An int representing the number of dictionary items.

Note

Subclasses may override this method.

BaseKerning._pop(key: KeyType, default: ValueType | None) ValueType | None

Remove a key from the native object and return it’s value.

This is the environment implementation of BaseDict.pop.

Parameters:
  • key – The key to remove. If a :cvar:`BaseDict.keyNormalizer` is set, it will have been applied to the given key.

  • default – The default value to return if the key is not found.

Returns:

The value associated with the given key, or the default value if the key is not found. If a :cvar:`BaseDict.valueNormalizer` is set, it will be applied in the calling method to the returned value.

Note

Subclasses may override this method.

BaseKerning._round(multiple: int) None[source]

Round the native kerning values to the specified increments.

This is the environment implementation of BaseKerning.round.

Parameters:

multiple – The increment to which the kerning values should be rounded as an int.

Note

Subclasses may override this method.

BaseKerning._scale(factor: list[int | float] | tuple[float, float]) None[source]

Scale all native kerning values by the specified factor.

This is the environment implementation of BaseKerning.scaleBy.

Parameters:

factor – The factor by which to scale the kerning as a tuple of two int or float values representing the factors (x, y). The first value is used to scale the kerning values.

Note

Subclasses may override this method.

BaseKerning._update(other: MutableMapping[KeyType, ValueType]) None

Update the current native object instance with key-value pairs from another.

This is the environment implementation of BaseDict.update.

Parameters:

other – A MutableMapping of key-value pairs to update this dictionary with. If both :cvar:`BaseDict.keyNormalizer` and :cvar:`BaseDict.valueNormalizer` are set, they will have been applied to the keys and values, respectively.

Note

Subclasses may override this method.

BaseKerning._values() BaseValues[ValueType]

Return a view of the values in the native object.

This is the environment implementation of BaseDict.values.

Returns:

A BaseValues object instance. If a :cvar:`BaseDict.valueNormalizer` is set, it will be applied to each value in the returned view.

Note

Subclasses may override this method.