Features

Description

Features is text in the Adobe Font Development Kit for OpenType .fea syntax that describes the OpenType features of your font. The OpenType Cookbook is a great place to start learning how to write features. Your features must be self-contained; for example, any glyph or mark classes must be defined within the file. No assumption should be made about the validity of the syntax, and FontParts does not check the validity of the syntax.

Note

It is important to note that the features file may contain data that is a duplicate of or data that is in conflict with the data in BaseKerning, BaseGroups, and BaseInfo. Synchronization is up to the user and application developers.

font = CurrentFont()
print(font.features)

Overview

BaseFeatures.copy

Copy the current object into a new object of the same type.

BaseFeatures.font

Get the feature's parent font object.

BaseFeatures.text

Get or set the features text.

Reference

class fontParts.base.BaseFeatures(*args: Any, **kwargs: Any)[source]

Represent the basis for a features object.

This class contains the font’s Adobe Font Development Kit for OpenType (AFDKO) feature definitions.

Copy

BaseFeatures.copy() BaseObjectType

Copy the current object into a new object of the same type.

The returned object will not have a parent object.

Returns:

A new BaseObject subclass instance with the same attributes.

Parents

BaseFeatures.font: dynamicProperty

Get the feature’s parent font object.

This property is read-only.

Returns:

The BaseFont instance containing the features or None.

Raises:

AssertionError

  • If attempting to set the font when it has already been set and is not the same as the provided font.

Example:

>>> font = features.font

Attributes

BaseFeatures.text: dynamicProperty

Get or set the features text.

The value must be a AFDKO FEA formatted str or None.

Returns:

A str representing the font’s features text, or None.