<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Jari,<br>
<br>
>Do you get empty string lengths where i.LuaString seems to
result in empty strings?
<br>
No, the string.len() and i:GetLength() results were indeed never
wrong, it's only the i.LuaString that troubles me.<br>
<br>
The i.LuaString is definitely empty when adding 3 or 4 unicode
letters, although - weird surprise - i:GetLength() returns the
correct unicode length. If you look at the console output at the
very bottom of the mail, you see the weird result: Length>2,
but no string output, although the output is fine with 1 and 2
letters of the same code.<br>
<br>
I attached a modified script where I write the LuaString into a
new FCTextExpressionDef to show that the empty console output is
correct and not an "invisible" string coding.<br>
When you open the text expression dialog, the third and fourth
expression are completely empty - just like the printed result
from the console. I also attached a screenshot of the created text
expression definitions: instead of 3 or 4 violin clefs in Bravura,
the text area is empty.<br>
<br>
It took me quite some time to track down this pretty weird
behaviour, when it first came up two months ago. I did a lot of
testing and combinations of different characters, and I am pretty
sure that it is a LuaString problem created through
CreateEnigmaStrings.<br>
As a workaround I wrote my own CreateEnigmaStrings routine which
solved the problem, but probably is much slower than your C++
routine and definitely not so well tested.<br>
<br>
Best regards,<br>
Jan<br>
<br>
function CreateNewTextExpression(textvalue)<br>
local catdef = finale.FCCategoryDef()<br>
catdef:Load(1)<br>
local exprdef = finale.FCTextExpressionDef()<br>
exprdef:SaveNewTextBlock(textvalue)<br>
textvalue:TrimEnigmaTags()<br>
exprdef:SetDescription(textvalue)<br>
exprdef:AssignToCategory(catdef)<br>
exprdef:SetUseCategoryPos(false)<br>
exprdef:SetUseCategoryFont(false)<br>
exprdef:SetVerticalAlignmentPoint(finale.ALIGNVERT_ABOVE_STAFF_BASELINE)<br>
exprdef:SetVerticalBaselineOffset(0)<br>
exprdef:SetVerticalEntryOffset(0)<br>
exprdef:SetHorizontalAlignmentPoint(finale.ALIGNHORIZ_LEFTOFALLNOTEHEAD)<br>
exprdef:SetHorizontalJustification(finale.EXPRJUSTIFY_LEFT)<br>
exprdef:SetHorizontalOffset(0)<br>
exprdef:SetBreakMMRest(false)<br>
exprdef:SaveNew()<br>
end<br>
<br>
function SplitEnigma(text)<br>
--Create enigma strings and print all non-enigma commands
(i.e.all texts)<br>
print("String to split:",text.LuaString)<br>
local splittext=text:CreateEnigmaStrings(true)<br>
for i in each(splittext) do<br>
if not i:IsEnigmaCommand() then<br>
print("String:",i.LuaString,i:GetLength())<br>
i.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"..i.LuaString<br>
CreateNewTextExpression(i)<br>
end<br>
end<br>
end<br>
<br>
local text=finale.FCString()<br>
text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"<br>
text:AppendCharacter(0xe050)<br>
SplitEnigma(text)<br>
<br>
text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"<br>
text:AppendCharacter(0xe050)<br>
text:AppendCharacter(0xe050)<br>
SplitEnigma(text)<br>
<br>
text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"<br>
text:AppendCharacter(0xe050)<br>
text:AppendCharacter(0xe050)<br>
text:AppendCharacter(0xe050)<br>
SplitEnigma(text)<br>
<br>
text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"<br>
text:AppendCharacter(0xe050)<br>
text:AppendCharacter(0xe050)<br>
text:AppendCharacter(0xe050)<br>
text:AppendCharacter(0xe050)<br>
<br>
SplitEnigma(text)<br>
text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"<br>
text:AppendCharacter(123)<br>
text:AppendCharacter(123)<br>
text:AppendCharacter(123)<br>
text:AppendCharacter(123)<br>
SplitEnigma(text) <br>
<br>
Running [Unnamed Script] ======><br>
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0)<br>
String: 1<br>
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0)<br>
String: 2<br>
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0)<br>
String: 3 <font color="#ff0000">---!! empty string
output, but length returns 3 !!</font><br>
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0)<br>
String: 4 <font color="#ff0000">---!! empty string
output, but length returns 4 !!</font><br>
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0){{{{<br>
String: {{{{ 4<br>
<======= [Unnamed Script] succeeded (Processing time: 0.010 s).<br>
</div>
</body>
</html>