The plugin allows the concatenation of up to six texts. Additionally, the justification of the text can be selected. With justifications 'Left' and 'Right', there is a corresponding 'preserve width' option which is triggered by selecting 'Left and wide' or 'Right and wide'. For the non-wide justifications, there are boxed variants which draw a box around the text (if the box is too high, try to set a pinch value on StaffSymbols texts to reduce its height).

Multiline texts are supported: Just insert %br% or | (a vertical bar) in a text to indicate a line break. For some fonts, the line sizes get too large - try to increase the "pinch" value to reduce the size of such lines.

With the StaffSymbols or StaffCueSymbols fonts, a number of abbreviations are useful - they are replaced with the corresponding staff character:

It is also possible to specify characters via decimal or hexadecimal codes:

decimal codes: e.g. %177%

hexadecimal codes: e.g. %0xf123%

Then, one can specify an arbitrary font installed in Windows for each segment by putting it between % and :% at the very beginning (in that case, the selected font class is ignored). This is helpful e.g. to use symbols like arrows from the WingDings fonts - and it does not use up one of the six NWC User font classes. See XTextExamples.nwctxt for examples (they need WingDings and WingDings 3 to be installed).

For "negative kerning" (moving the following text to the left), use %---...%. Each minus sign represents a little more than a quarter of a "left-moving" blank. This is useful to create e.g. an "fp" symbol, which can be done with the StaffSymbols text segment %f%%--%%p% (see XText_fp_sffffz_Examples.nwctxt).

Lst, it is possible to "jump back" to the start of a previous text with %-1%, %-2%, ..., or %-6%. This is useful to place text pieces above each other, e.g. for the numbers needed for figured bass or for piano fingering.

The name of the plugin, XText, allows quick selection via keyboard by pressing J X <down> <enter>. The X can be read as "extended" or simply as a reference (and reverence) to NWC's native texts, which are created from the keyboard with a simple X.

As special examples, I have added a score of two measures from Rachmaninov's Prelude in C sharp which is used in the German Wikipedia as a comparison example for score editors (however, the NWC output could not be added there, as only native features may be used, which excludes the "sffff" XText); and an excerpt from Diether de la Motte's "Harmonielehre", which explains the harmonic functions of the final six measures of Bach's famous Air in D. Of course, one can also write degree symbols using similar parameters.

If I may suggest a variant, or perhaps an extention: I often find myself needing to create a (Centre, Left or Right) justified, multi-line block of text, that can also need different fonts, sometimes within a line.

This plugin allows for the different fonts within a line, can you also add multi-line functionality? Or should that be a separate plugin?

I'll work on it - it's a pure algorithmic problem, i.e., what I like most about programming!

But it will take a day or two, as I have to play organ at three occasions this weekend (a wedding and two confirmations at our church), and that Bach does not yet really work = I need some more practice time today ...; oh, and I have to transpose three scores one or two semitones up or down for our choir - NWC does it in a snap, but at one place this requires rewriting a recitative, as our solo tenor cannot go even higher ...

It also has a properties dialog that looks like the control panel for a medium-sized nuclear reactor. I hope that people aren't put off by it, but I did not see any other way to get the necessary information.

And, it may be that the size computations are too simplistic - I did not try to learn what "descent" means, and how it should be used in computing the text layout.

Still, happy texting - and feel free to comment on my attempt (but I'd rather go back to the Envelope plugin, which is, as I see it, more satisfying from a musical perspective).

H.M.

P.S. And yes, the Bach is ok now (I'll see whether the couple likes it tomorrow), and the scores are transposed, and the recitative rewritten ...

In 0.5, I have added a justification 'Left and wide' to get left-justification and "preserve width" behavior. However, this shows that with multiline support, there is now an overlapping, or unclear, or muddled semantics for justifications: The "left" and "right" are used for both "justification relative to left side of text block" and "justification relative to plugin position". Therefore, the "left and wide" justification is actually a "right" justification with respect to the plugin's loction. But I'm not going to "correct" this (by introducing two independent "justifications"), mainly because the plugin right now needs all 32 possible properties; but also as there are already enough possibilities to format the text, I think - the workaround for other layouts is, as before, to use standard texts and placing them as needed.

If I may, I have a suggestion for a little extension: I often have had some trouble to place "commented" dynamics in a score, like for example "p dolce" or "sempre f". I could imagine to have the option to choose "Dynamic" instead of text in your object. This would be very helpful to insert special dynamics like the ones I mentioned above...

Hi jfb,you could pretty much do that now with the plugin in its current form. Just change the font selection between the text and the dynamic so that you use the dynamic marking from the notation font (NWC2STDA or alternative).

As Lawrie points out, the dynamic signs are in the StaffSymbols font, so you could just find them there ...

... however, in version 0.6 I have added a number of abbreviations for quite a few characters from that font: Just select font StaffSymbols, and then use e.g. %ppp% or %f% or %cclef% or %#% etc. For all symbols, look into the help text. If you want some more symbols added, just tell me (including the abbreviation name you think is helpful).

XTextExamples.nwctxt (attached to the primary posting) contains some examples for this, e.g. the "sempre pp" xtext.

A technical remark and question: The code simply replaces the abbreviations with single letters, as defined in a table with entries like

Thus, for %ppp%, the character P is substituted, which has hex code 0x50. However, when I look into the CharMap of the standard StaffSymbols font NWC2STDA, the ppp symbol has character code 0xf050. Yet, my code works ... but I am not really sure why; and whether there might be circumstances when it does not work. Could someone tell me what's going on here? - thanks!

A question/suggestion for you: I notice in your code you have a function named replaceAll(text, k, v) where you are doing string.find() and string.sub() within a loop. Did you consider using the Lua string.gsub() function? I think it should work well for what you are doing.

Ha - you got me! ... yes, I considered it for a second, but I have not yet "interned" (in my mind) the Lua patterns (too much experience with the "big" regexps of C# etc.), so I am a little too cautious there. But right after uploading the script, I thought that the following much simpler code should work:

Another update (I think it's the last one): I added explicit negative kerning, i.e., the possibility to move a piece of text to the left. A simple example is the composition of an "fp" dynamic signature from the existing f and p dynamics, which can be done with the StaffSymbols text segment %f%%---%%p%.

The attachments of the primary posting show some more example usages.

The addition of this feature required a complete rewrite of the internal logic, so I may have introduced new bugs - if you find any, let me know!

Version 0.9 allows the specification of arbitrary Windows fonts in an segment. I think this should be very useful for the small arrows sometimes needed when voices are split or come together ("Behind Bars" shows an example on p.468; I see them often in John Rutter scores).

I added another example (DeLaMotte_BachAirD_m13-18_Harmonielehre_p125.nwc) to the intial posting for using XText : Adding functional symbols to a score. The example is from Diether de la Motte's "Harmonielehre" and explains the harmonic functions of the final six measures of Bach's famous Air in D. Of course, one can also write degree symbols using similar parameters.

In a typical example of feature creep, I have uploaded version 0.91, which allows "jumping back" to the beginning of a segment. This helps with texts that should be exactly above each other, as in the 6 and 4 of chord symbols, or maybe for piano fingering. Unfortunately, the new version 0.91 is not compatible with the previous versions with respect to the %---...% negative kerning: The size of a single minus has changed a little bit - sorry to those of you who already used this feature: Please check that the location of left-shifted text pieces is still ok ...

Version 0.92 adds simple boxes around texts if one of the "... (boxed)" justifications is selected.

There is no way to select margins, line thickness, corner rounding or the like for the box. The reason (which I have explained somewhere else already) is that XText needs all 32 possible parameters right now: 5 parameters for each of the 6 texts, and two for justification and line spread. So I cannot introduce any new parameters.

One could implement a Box object which looks at the next object and boxes it; where the next object could be a standard text, or an XText, or maybe one of some other supported type of item: That way, one could add versatile box controls only once ...