I had a few interesting requests about PDF output for songs. Instead of patching it here and there, I’ve completely rewritten the export engine, exposing as much options as possible. For example, you can now generate two-sided colored PDF’s with landscape diagrams. Furthermore, the new engine knows where to split song to fill another page or column (the former one worked parts by parts, but the new one can cut inside a part if some conditions are matched). This enhanced engine is available starting from version 2.1.
When you generate a PDF with the app, the resulting document is a stacking of boxes, each one of them corresponding to a specific part of the song (like the title, the composer, the song by itself or the page numbers for example). Each box can now have its own style (a set of properties like margins, fonts, colors, etc.).
If the box contains only regular text like the title or composer box, its style is defined by:
- The font;
- The scale for the content of the box;
- The text alignment (left, center or right);
- The text color;
- The flush of the box (left, center or right) (see below);
- The box margins;
Each box has a visibility switch. When a box is hidden, its area is reclaimed and remaining boxes are repositioned. The reordering of boxes is of course possible.
The song content box (or the header’s gathered chords box to a lower extent) has a more complex style. For this box, you can define:
- Fonts (Lyrics, Chord symbols, Part names);
- Scales. The app uses lyrics scale as a reference. Chords and Part names scales are defined with respect to this lyrics scale;
- Colors for each element;
- The number of columns (1, 2 or 3);
- Visibility by element type (show or hide fingerings/chords/lyrics);
- How chord fingerings are displayed or positioned.
- Margins and various spaces between elements. You can set independently the space between two rows of chords or between a line of lyrics and its chords for example.
I choose to use relative scales because they are more meaningful for the user. With this, you can rescale the whole song content with only one parameter (the lyrics scale). Chords and part names scales are derived from this parameter and will adapt accordingly. Thus if you set the chord scale to 2.0, chords symbols are twice as big as lyrics. If you then change the lyrics scale from 1.0 to any other value, chords will still be twice as big as the lyrics. The whole content will simply be smaller or bigger.
The flush parameters define how a box will stack with preceding ones. Centered boxes are as wide as the whole page, and flushed left or right boxes are half the width of the page and can slide to stack with boxes of the same type (or centered ones). A left flushed box will always slide up sideways of any right flushed box (they live in different halves of the page). With these properties, you can generate two column headers for your song with, for example, the style and the key to the left, and the composer and tuning to the right.
In the previous version of the app, they were only four fonts for the document (Title, Emphasized, Lyrics and Chords symbols). Now, each box can have its own font. The old global controls are still here for convenience and can be used to set the same font across several boxes. Thus, setting the “Emphasized” font will change the fonts in boxes containing the subtitle, style, composer, key, tuning, copyright, year, as well as in the footer box which contain page numbers, and the part names in the song content box. This correspond to the former attribution of this font. Other font settings are obvious and affect their corresponding boxes.
The collections of all PDF export properties (the sequence of styled boxes, but also document wide properties like the page size and margins, the global scale of the content, and duplex (two-side) options) form a template.
The global scale parameter drives the rendering scale within the page. Only page margins are unaffected. Since this global scale affect, but doesn’t overwrite, individual boxes scales, it can be used to quickly tweak all boxes and make a song fit in one page for example.
For now, there is only one template active in the app. Having multiple templates is planned, with possibly some sharing capabilities.
With ordered tags coming in a next update, whole song book generation with several songs will be possible, with a cover and an automatic table of contents.