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¶
Copy this object into a new object of the same type. |
Parents¶
The guideline's parent |
|
The guideline's parent |
|
The guideline's parent |
Identification¶
The name of the guideline. |
|
The unique identifier for the object. This value will be an Identifier or a |
|
The index of the guideline within the ordered list of the parent glyph's guidelines. This attribute is read only. ::. |
Attributes¶
The x coordinate of the guideline. It must be an Integer/Float. ::. |
|
The y coordinate of the guideline. It must be an Integer/Float. ::. |
|
The angle of the guideline. It must be an Angle. Please check how |
Transformations¶
Transform the object. |
|
Move the object. |
|
Scale the object. |
|
Rotate the object. |
|
Skew the object. |
Normalization¶
Round the guideline's coordinate. |
Environment¶
Return the environment's native object that has been wrapped by this object. |
|
Tell the environment that something has changed in the object. |
Reference¶
- class fontParts.base.BaseGuideline(*args, **kwargs)[source]¶
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¶
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 object. This value will be an Identifier or a
None
. This attribute is read only.>>> object.identifier 'ILHGJlygfds'
To request an identifier if it does not exist use object.getIdentifier()
- 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.normalizeRotationAngle
handles the angle. There is a special case, when angle isNone
. 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.moveBy((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.scaleBy(2.0) >>> obj.scaleBy((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.rotateBy(45) >>> obj.rotateBy(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¶
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()