Creating new notation styles
Prev
Next

Creating new notation styles

Rosegarden's notation editor has the ability to display and edit notes in various standard styles: classical, diamond heads and so on. These styles are all defined in XML style definition files installed along with the application, and it's possible to create a new one by writing a simple XML file. Rosegarden simply looks at the set of installed files to determine which styles to offer the user. You can refer to the default set of files in the styles subdirectory of the Rosegarden installation directory for examples.

The file format is not yet especially comprehensive; at the moment it has been designed to be powerful enough to describe the standard styles that come with Rosegarden, but not much more. If you should try to create new styles this way, we'd be very interested in your feedback on the Rosegarden mailing-lists.

Notation style XML format

Here is a summary of the XML elements that may be used in a style definition file.

rosegarden-note-style

This element must exist in every style file, and should contain all the other elements. It has one optional attribute, "base-style", which may be used to name a style from which this style takes the default values for any parameters not specified elsewhere in the present file. It's often good practice to define a style in terms of the minimal difference from a given base style: see the supplied Cross.xml for a particularly simple example.

Note that the "rosegarden-note-style" element does not give the name of the style being defined, which is instead currently drawn from the name of the file. At some point in the future we may add internationalizable style name attributes to this element.

global, note

Within the "rosegarden-note-style" element, there may be one "global" element and any number of "note" elements. We describe these together, as they have almost identical sets of attributes. The "global" element simply provides default values for those parameters not specified for a particular note type in any following "note" element.

The attributes for these elements are as follows. All of these are optional except as described:

type

Only relevant to the "note" element, and mandatory for that element. This attribute specifies which sort of note is being styled. Legal values are textual American or British note names (from "64th", "sixth-fourth note", "hemidemisemiquaver" etc to "double whole note").

shape

Defines a note head shape for this style. Any string is a legal value, but the only values implemented so far are "angled oval", "level oval", "breve", "cross", "triangle up", "triangle down", "diamond" and "rectangle". The value "number" is also recognised but not yet implemented.

charname

Defines a note font character name to be used as the note head for this style. An element may supply a "shape" or "charname" attribute, but not both. The name should be one of those defined in the current notation font's symbol map (in a "name" attribute).

filled

Specifies whether this note should have a filled head (where applicable, i.e. where the shape attribute supplies a shape that is available both filled and unfilled). Must be "true" or "false".

stem

Specifies whether this note should have a stem. Must be "true" or "false".

flags

Defines how many flags or beams this note should have. The valid range is 0 to 4.

slashes

Defines how many slashes this note should have across its stem.

hfixpoint

Specifies in which x position the stem fixes to the note head. Acceptable values are "normal" (the right side when the stem points up, the left when it points down), "central", and "reversed" (left side when the stem points up, right when it points down).

vfixpoint

Specifies in which y position the stem fixes to the note head. Acceptable values are "near" (the stem fixes to the top when pointing up, the bottom when pointing down), "middle", or "far".

Prev
Next
Home