Common Value Types

FontParts scripts are built on with objects that represent fonts, glyphs, contours and so on. The objects are obtained through fontParts.world.

FontParts uses some common value types.

String

Unicode (unencoded) or string. Internally everything is a unicode string.

Integer/Float

Integers and floats are interchangeable in FontParts (unless the specification states that only one is allowed).

Coordinate

An immutable iterable containing two Integer/Float representing:

  1. x

  2. y

Angle

XXX define the angle specifications here. Direction, degrees, etc. This will always be a float.

Identifier

A String following the UFO identifier conventions.

Color

An immutable iterable containing four Integer/Float representing:

  1. red

  2. green

  3. blue

  4. alpha

Values are from 0 to 1.0.

Transformation Matrix

An immutable iterable defining a 2x2 transformation plus offset (aka Affine transform). The default is (1, 0, 0, 1, 0, 0).

Immutable List

This must be an immutable, ordered iterable like a tuple.

Lib Value

class fontParts.base.annotations.LibValue[source]

A BaseLib value may be one of the following non-collection types:

In addition, a value may also be a list or tuple containing any of the types above, or a dict mapping str keys to values of those same types (including nested lists, tuples, or dicts).