RoboFab Objects: RComponent

RoboFab RComponent

Usage

< RComponent for Excellent-Regular.adieresis.components[1] > ]]>

Description

A component can be a part of a glyph and it is a reference to another glyph in the same font. With components you can make glyphs depend on other glyphs. Changes to the baseGlyph will reflect in the component as well. Fontographer and RoboFog called them composites. The parent of a component is usually a glyph. Components can be decomposed: they replace themselves with the actual outlines from the baseGlyph. When that happens the link between the original and the component is broken: changes to the baseGlyph will no longer reflect in the glyph that had the component.

Attributes

  • baseGlyph: the name of the glyph the component points to. The glyph is assumed to be present in the same font. Note: in FontLab this attribute is readonly.
  • index: the index of the component in the list of components in the parent glyph. i.e. the first component in a glyph has index 0.
  • offset: offset vector (x, y). The distance the component has been moved.
  • scale: scale (x, y). The distance the component has been moved.
  • box: the bounding box for the component (read only).

Attribute examples

Methods

  • decompose(): in the parent glyph replace this component object with the actual contours. This practically ends the existence of the component object.
  • move((x, y)): move the component to position (x, y)
  • draw(aPen): draw this component with aPen
  • drawPoints(aPointPen): draw this component with aPointPen. Note: both these drawing methods are usually called by aGlyph.draw() and aGlyph.drawPoints() as part of the drawing process.
  • copy(): return a deep copy of the object.
  • setChanged(): call to indicate that something about the component has changed.

Method examples