Parchment layout
Parchment layout lays bars out page-style but honors the systems layout embedded in the source file โ the row breaks and relative bar widths the engraver chose in Guitar Pro. Reach for it when publishing method books, songbooks, or educational material where the author's line breaks are the story โ a phrase intentionally left on its own row, a coda pinned to a fresh system. The alternative โ letting alphaTab re-pack the bars โ would silently rewrite that engraving choice.
What Parchment reads from the score modelโ
Parchment consults per-track fields when a single track is rendered, and per-score fields when multiple tracks are:
systemsLayoutโ an array describing how many bars land in each row. Consumed row by row until the values run out.defaultSystemsLayoutโ the fallback bars-per-row oncesystemsLayoutis exhausted.bar.displayScale(single track) /masterBar.displayScale(multi-track) โ a relative weight controlling how the available row width is distributed across the bars in that row. Two bars withdisplayScale = 1share the row evenly; a bar withdisplayScale = 2gets twice the space of a1.
Prefix and postfix glyphs โ clef, key signature, time signature, barlines โ keep their natural width. displayScale distributes what's left of the row.
Overriding the source layoutโ
Mutate the model fields in a scoreLoaded handler to override what the file carried โ useful when adapting an embedded layout for a smaller viewport or when authoring a layout for a score that ships without one.
Show it in codeโ
import * as alphaTab from '@coderline/alphatab';
const container = getAlphaTabContainer();
const api = new alphaTab.AlphaTabApi(container, {
core: { file: '/scores/song.gp' },
display: {
layoutMode: alphaTab.LayoutMode.Parchment,
},
});
api.scoreLoaded.on((score) => {
score.defaultSystemsLayout = 4;
score.masterBars[0].displayScale = 1.5;
});
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โ
- Page layout โ the automatic packing mode.
- Density and spacing โ tune spacing when the model layout leaves you room to.
display.layoutModeandLayoutModereference entries.