SourceForge.net Logo

3.6. The Text element

Elements of type text are used for placing arbitrary strings of text on the score. They must not be used to place neither the lyrics under the notes nor the score titles as for both of them there are specific elements.

[39]Text::= (text TextString [Location] [Font] [Alignment] [Origin] [hasWidth] )  
[40]Origin::= { bottom | top }  

Examples:

(text "Angelus dicit:" (dx -5)(dy 60))
(text "Allegro" dy:-30)
(text "A" dy:0 hasWidth)
(text "Right" dy:40 right (font normal 24))
(text "Example 1" dx:center dy:20 center)

Parameter Origin specifies the line used as reference in the Location parameter: either the top line of the text or its bottom line. By default, location parameter refers to the bottom line of the text.

Parameter Alignment refers to how the text will be positioned, relative to the specified location point and origin:

  • left - text will be placed such that the right edge of the last character will be at the specified point. Depending on the specified or implied default origin, it will be the right top corner if origin is 'top', or the right bottom corner if origin is 'bottom'.
  • right - text will be placed such that the left edge of the first character and the origin line will be at the specified point.
  • center - text will be placed such that the middle of the string will be at the specified point.

Location should be normally relative to the parent's anchor point. But in case of text elements defined in a measure, they are relative to current x position and fifth line of staff.

The font settings are stored as new default settings for coming text elements

By default, text elements do not influence the note spacing. To take text width into account, parameter hasWidth must be included.

The location admits an special keyword, dx:center, which means 'center of current measure'. This moves the current x location to the center of the space occupied by current measure. Using this keyword in conjunction with alignment center simplifies placing texts centered in a measure.