Guideline

Description

Guidelines are reference lines in a glyph that are not part of a contour or the generated font data. They are defined by a point and an angle; the guideline extends from the point in both directions on the specified angle. They are most often used to keep track of design information for a font (‘my overshoots should be here’) or to measure positions in a glyph (‘line the ends of my serifs on this line’). They can also be used as reference positions for doing things like assembling components. In most font editors, guidelines have a special appearance and can be edited.

glyph = CurrentGlyph()
for guideline in glyph.guidelines:
        print guideline

Overview

Copy

BaseGuideline.copy Copy this object into a new object of the same type.

Parents

BaseGuideline.glyph The guideline’s parent BaseGlyph.
BaseGuideline.layer The guideline’s parent BaseLayer.
BaseGuideline.font The guideline’s parent BaseFont.

Identification

BaseGuideline.name The name of the guideline.
BaseGuideline.color
BaseGuideline.identifier The unique identifier for the guideline.
BaseGuideline.index The index of the guideline within the ordered list of the parent glyph’s guidelines.

Attributes

BaseGuideline.x The x coordinate of the guideline.
BaseGuideline.y The y coordinate of the guideline.
BaseGuideline.angle The angle of the guideline.

Transformations

BaseGuideline.transformBy Transform the object.
BaseGuideline.moveBy Move the object.
BaseGuideline.scaleBy Scale the object.
BaseGuideline.rotateBy Rotate the object.
BaseGuideline.skewBy Skew the object.

Normalization

BaseGuideline.round Round the guideline’s coordinate.

Environment

BaseGuideline.naked Return the environment’s native object that has been wrapped by this object.
BaseGuideline.changed Tell the environment that something has changed in the object.

Reference

class fontParts.base.BaseGuideline(*args, **kwargs)

A guideline object. This object is almost always created with BaseGlyph.appendGuideline. An orphan guideline can be created like this:

>>> guideline = RGuideline()

Copy

BaseGuideline.copy()

Copy this object into a new object of the same type. The returned object will not have a parent object.

Parents

BaseGuideline.glyph

The guideline’s parent BaseGlyph.

BaseGuideline.layer

The guideline’s parent BaseLayer.

BaseGuideline.font

The guideline’s parent BaseFont.

Identification

BaseGuideline.name

The name of the guideline. This will be a String or None.

>>> guideline.name
'my guideline'
>>> guideline.name = None
BaseGuideline.color

” The guideline’s color. This will be a Color or None.

>>> guideline.color
None
>>> guideline.color = (1, 0, 0, 0.5)
BaseGuideline.identifier

The unique identifier for the guideline. This value will be an Identifier. This attribute is read only.

>>> guideline.identifier
'ILHGJlygfds'

If the guideline does not have an identifier, one will be generated and assigned to the guideline when this attribute is requested.

BaseGuideline.index

The index of the guideline within the ordered list of the parent glyph’s guidelines. This attribute is read only.

>>> guideline.index
0

Attributes

BaseGuideline.x

The x coordinate of the guideline. It must be an Integer/Float.

>>> guideline.x
100
>>> guideline.x = 101
BaseGuideline.y

The y coordinate of the guideline. It must be an Integer/Float.

>>> guideline.y
100
>>> guideline.y = 101
BaseGuideline.angle

The angle of the guideline. It must be an Angle. Please check how normalizers.normalizeGuidelineAngle handles the angle. There is a special case, when angle is None. If so, when x and y are not 0, the angle will be 0. If x is 0 but y is not, the angle will be 0. If y is 0 and x is not, the angle will be 90. If both x and y are 0, the angle will be 0.

>>> guideline.angle
45.0
>>> guideline.angle = 90

Transformations

BaseGuideline.transformBy(matrix, origin=None)

Transform the object.

>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0))
>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0), origin=(500, 500))

matrix must be a Transformation Matrix. origin defines the point at with the transformation should originate. It must be a Coordinate or None. The default is (0, 0).

BaseGuideline.moveBy(value)

Move the object.

>>> obj.transformBy((10, 0))

value must be an iterable containing two Integer/Float values defining the x and y values to move the object by.

BaseGuideline.scaleBy(value, origin=None)

Scale the object.

>>> obj.transformBy(2.0)
>>> obj.transformBy((0.5, 2.0), origin=(500, 500))

value must be an iterable containing two Integer/Float values defining the x and y values to scale the object by. origin defines the point at with the scale should originate. It must be a Coordinate or None. The default is (0, 0).

BaseGuideline.rotateBy(value, origin=None)

Rotate the object.

>>> obj.transformBy(45)
>>> obj.transformBy(45, origin=(500, 500))

value must be a Integer/Float values defining the angle to rotate the object by. origin defines the point at with the rotation should originate. It must be a Coordinate or None. The default is (0, 0).

BaseGuideline.skewBy(value, origin=None)

Skew the object.

>>> obj.skewBy(11)
>>> obj.skewBy((25, 10), origin=(500, 500))

value must be rone of the following:

  • single Integer/Float indicating the value to skew the x direction by.
  • iterable cointaining type Integer/Float defining the values to skew the x and y directions by.

origin defines the point at with the skew should originate. It must be a Coordinate or None. The default is (0, 0).

Normalization

BaseGuideline.round()

Round the guideline’s coordinate.

>>> guideline.round()

This applies to the following:

  • x
  • y

It does not apply to

  • angle

Environment

BaseGuideline.naked()

Return the environment’s native object that has been wrapped by this object.

>>> loweLevelObj = obj.naked()
BaseGuideline.changed(*args, **kwargs)

Tell the environment that something has changed in the object. The behavior of this method will vary from environment to environment.

>>> obj.changed()