Skip to main content

Track name policies

Control where track names appear, whether each system uses the full or short form, and whether the label reads horizontally or rotated. Six stylesheet fields โ€” grouped into three pairs โ€” cover every combination, so a mobile view can drop names that no longer fit, and a printed songbook can spell out the instrument once and abbreviate it on every following system.

The three pairsโ€‹

The stylesheet splits track-name display along three axes: policy (where), mode (which text), and orientation (how it's rotated). Policy has one field per rendering context (single-track vs multi-track). Mode and orientation each have one field for the first system and one for every other system, because those two positions typically want different treatment.

Policy: single track vs multi trackโ€‹

Both take a TrackNamePolicy:

  • Hidden โ€” never draw the name.
  • FirstSystem โ€” draw only above the first system (default).
  • AllSystems โ€” repeat the name on every system.

Splitting the policy by render context lets you keep a compact single-track view while still labeling every system in an ensemble score.

Mode: full name vs abbreviationโ€‹

Both take a TrackNameMode:

  • FullName โ€” uses Track.name (e.g. "Distortion Guitar").
  • ShortName โ€” uses Track.shortName (e.g. "Dist. Gtr.", default on both).

The typical engraver's choice is FullName on the first system and ShortName on the rest โ€” the reader learns the instrument once and then reads the compact form the rest of the way.

Orientation: horizontal vs verticalโ€‹

Both take a TrackNameOrientation:

  • Horizontal โ€” left-to-right text.
  • Vertical โ€” bottom-to-top rotated text (default on both).

Vertical labels keep the left margin narrow; horizontal labels read faster but push the staves inward.

Show it in codeโ€‹

import * as alphaTab from '@coderline/alphatab';

const container = getAlphaTabContainer();
const api = new alphaTab.AlphaTabApi(container, {
core: { file: '/scores/song.gp' },
});

api.scoreLoaded.on((score) => {
const s = score.stylesheet;
s.multiTrackTrackNamePolicy = alphaTab.model.TrackNamePolicy.AllSystems;
s.firstSystemTrackNameMode = alphaTab.model.TrackNameMode.FullName;
s.otherSystemsTrackNameMode = alphaTab.model.TrackNameMode.ShortName;
s.firstSystemTrackNameOrientation = alphaTab.model.TrackNameOrientation.Horizontal;
s.otherSystemsTrackNameOrientation = alphaTab.model.TrackNameOrientation.Vertical;
api.render();
});

getAlphaTabContainer() is a placeholder for the platform-specific step of obtaining the render target โ€” a <div> on Web, an AlphaTab control on .NET, or an AlphaTabView on Android. Every other line runs unchanged on all three runtimes.

Where to look nextโ€‹