458
The documentation says:
But the following tool,
local f = nwcut.loadFile()
for i = 1, #f.Staff do
for j = 1, #f.Staff[i].Items do
local item = f.Staff[i].Items[j]
nwcut.warn(i ..'/'..j ..' --> '..(item:HasDuration() and 'true' or 'false')..'\n')
end
end
nwcut.status = nwcut.const.rc_Report
when called on a new staff with two grace notes, outputs
1/1 --> true
1/2 --> true
I'll use
item:HasDuration() and not item.Opts.Dur.Grace
instead - I think this is what the documentation means ...
H.M.
499
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:
['%%1/8%%'] = 'H',
['%%ppp%%'] = 'P',
...
for k, v in pairs(replacements) do
text = string.gsub(text, k, v)
end
If you read this - do you have any complaints? - if not, I'll simply replace 0.6 (no functional change).
... I just did it
H.M.
500
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
['%1/8%'] = 'H',
['%ppp%'] = 'P',
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!
H.M.