Skip to content

Add property factory to BaseInfo. #846

@knutnergaard

Description

@knutnergaard

To improve documentation and annotation of BaseInfo attributes, I would propose adding a property factory which generates the attributes at runtime.

See this module for reference. It generates properties from a list of attribute names and adds values automatically based on glyph dimension, which may be overridden by the user. Attributes are documented with a simple summary line mapped to properties in ENGRAVING_DEFAULTS_ATTRIBUTES. Proper linting support is secured with stubs of annotated attribute names inside the class body.

BaseInfo would require a bit more complex type handling, but the basic approach for the base class should be the same.

I guess fontTools.ufoLib.fontInfoAttributesVersion3ValueData could be used as the source for attribute name and type, although the container types listes are not exhaustive in specification of items. Nor does it include description fields for each attribute to be used in documentation.

Perhaps fontTools.ufoLib.fontInfoAttributesVersion3ValueData could benefit from an upgrade in this regard?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions