Layer¶
Must Override¶
- BaseLayer._getItem(name: str, **kwargs: Any) BaseGlyph¶
Get the specified glyph from the native layer.
This is the environment implementation of
BaseLayer.__getitem__andBaseFont.__getitem__.- Parameters:
name – The name representing the glyph to get. The value will have been normalized with
normalizers.normalizeGlyphName.**kwargs – Additional keyword arguments.
- Returns:
an instance of a
BaseGlyphsubclass with the specified name.- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseLayer._get_color() tuple[float, float, float, float] | None[source]¶
Get the color of the layer.
This is the environment implementation of the
BaseLayer.colorproperty getter.- Returns:
The Color assigned to the layer, or
Noneto indicate that the layer does not have an assigned color. The value will be normalized withnormalizers.normalizeColor.- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseLayer._get_lib() BaseLib[source]¶
Get the native layer’s
BaseLibobject.This is the environment implementation of the
BaseLayer.libproperty getter.- Returns:
An instance of a
BaseLibsubclass.- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
- BaseLayer._get_name() str | None[source]¶
Get the name of the native layer.
- This is the environment implementation of the
BaseLayer.name property getter.
- :return A
strdefining the name of the current layer or
Noneto indicate that the layer is the default. The value will be normalized withnormalizers.normalizeLayerName.
- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- This is the environment implementation of the
- BaseLayer._keys(**kwargs: Any) tuple[str, ...]¶
Get the names of all glyphs in the native layer.
This is the environment implementation of
BaseLayer.keysandBaseFont.keys.
- BaseLayer._newGlyph(name: str, **kwargs: Any) BaseGlyph¶
Create a new glyph in the native layer.
This is the environment implementation of
BaseLayer.newGlyphandBaseFont.newGlyph.- Parameters:
name – The name of the glyph to create. The value will have been normalized with
normalizers.normalizeGlyphNameand tested to make sure that it is unique to the layer.**kwargs – Additional keyword arguments.
- Returns:
An instance of a
BaseGlyphsubclass.- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseLayer._removeGlyph(name: str, **kwargs: Any) None¶
Remove the specified glyph from the native layer.
This is the environment implementation of
BaseLayer.removeGlyphandBaseFont.removeGlyph.- Parameters:
name – The name of the glyph to remove. The value will have been normalized with
normalizers.normalizeGlyphName.**kwargs – Additional keyword arguments.
- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseLayer._set_color(value: list[int | float] | tuple[float, float, float, float] | None, **kwargs: Any) None[source]¶
Get or set the color of the layer.
This is the environment implementation of the
BaseLayer.colorproperty setter.- Parameters:
value – A Color or
Nonedefining the color to assign to the layer. The value will have been normalized withnormalizers.normalizeColor.**kwargs – Additional keyword arguments.
- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseLayer._set_name(value: str, **kwargs: Any) None[source]¶
Set the name of the native layer.
- This is the environment implementation of the
BaseLayer.name property setter.
- Parameters:
value – The name to assign to the layer. The value must be unique to the font and will have been normalized with
normalizers.normalizeLayerName**kwargs – Additional keyword arguments.
- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- This is the environment implementation of the
May Override¶
- BaseLayer._autoUnicodes() None[source]¶
Use heuristics to set Unicode values in all native font glyphs.
This is the environment implementation of
BaseLayer.autoUnicodes.Note
Subclasses may override this method.
- BaseLayer._contains(name: str, **kwargs: Any) bool¶
Test if the native layer contains the specified glyph.
This is the environment implementation of
BaseLayer.__contains__andBaseFont.__contains__.- Parameters:
name – The name of the glyph to check. The value will have been normalized with
normalizers.normalizeGlyphName.**kwargs – Additional keyword arguments.
- Returns:
Note
Subclasses may override this method.
- BaseLayer._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.
- BaseLayer._insertGlyph(glyph: BaseGlyph, name: str, **kwargs: Any) BaseGlyph¶
Insert a specified glyph into the native layer.
This is the environment implementation of
BaseLayer.__setitem__andBaseFont.__setitem__.An environment must not insert glyph directly, but rather copy it’s data to a new layer.
- Parameters:
glyph – A glyph object with the attributes necessary for copying as defined in
BaseGlyph.copyname – The name to assign to the new glyph after insertion. The value will have been normalized with
normalizers.normalizeGlyphNameand tested to make sure that it is unique to the layer.**kwargs – Additional keyword arguments.
- Returns:
The newly inserted
BaseLayersubclass instance.
Note
Subclasses may override this method.
- BaseLayer._interpolate(factor: list[int | float] | tuple[float, float], minLayer: BaseLayer, maxLayer: BaseLayer, round: bool, suppressError: bool) None[source]¶
Interpolate all possible data in the native layer.
This is the environment implementation of
BaseLayer.interpolate.- Parameters:
factor – The interpolation value as a single
intorfloator atupleof twointorfloatvalues representing the factors(x, y).minLayer – The
BaseLayersubclass instance corresponding to the 0.0 position in the interpolation.maxLayer – The
BaseLayersubclass instance corresponding to the 1.0 position in the interpolation.round – A
boolindicating whether the result should be rounded to integers.suppressError – A
boolindicating whether to ignore incompatible data or raise an error when such incompatibilities are found.
- Raises:
FontPartsError – If
suppressError=Falseand the interpolation data is incompatible.
Note
Subclasses may override this method.
- BaseLayer._isCompatible(other: BaseLayer, reporter: LayerCompatibilityReporter) None[source]¶
Evaluate interpolation compatibility with another native layer.
This is the environment implementation of
BaseFont.isCompatible.- Parameters:
other – The other
BaseLayersubclass instance to check compatibility with.reporter – An object used to report compatibility issues.
Note
Subclasses may override this method.
- BaseLayer._iter(**kwargs: Any) Iterator[BaseGlyph]¶
Iterate through the glyphs in the native layer.
This is the environment implementation of
BaseLayer.__iter__andBaseFont.__iter__.- Returns:
An iterator over instances of a
BaseGlyphsubclass.
Note
Subclasses may override this method.
- BaseLayer._len(**kwargs: Any) int¶
Return the number of glyphs in the native layer.
This is the environment implementation of
BaseLayer.__len__andBaseFont.__len__- Parameters:
**kwargs – Additional keyword arguments.
- Returns:
The number of
BaseGlyphsubclass instances in the layer as anint.
Note
Subclasses may override this method.
- BaseLayer._round() None[source]¶
Round all approriate native layer data to integers.
This is the environment implementation of
BaseLayer.round.Note
Subclasses may override this method.