[JW Lua] Multi-byte characters
Jari Williamsson
jari.williamsson at mailbox.swipnet.se
Mon Aug 4 15:32:01 CEST 2014
Bart,
You can do the character replacements to a FCString directly in JW Lua,
using the FCString:SetItemAt() method and using the Unicode numbers.
Please note that the string position is 0-based.
Run the code sample below on a default Finale document on Finale 2012 or
later. It should put "Tëst" at the place where the title page text was.
Since U+00EB is the standard Unicode number for "ë", 0x00EB or 0xEB
would be the hexadecimal representation of that Unicode character to use
for FCString:SetItemAt(). (In Lua, 0x is the prefix for hexadecimal
numbers.)
---
local s = finale.FCString()
s.LuaString = "Test"
s:SetItemAt(1, 0x00EB) -- Change second character in string
s:Insert("^font(Times New Roman)^size(16)^nfx(0)", 0)
local pt = finale.FCPageText()
pt:Load(1, 0) -- Load first page text object on page 1
pt:SaveTextString(s) -- Save the new text for that block
---
Best regards,
Jari Williamsson
On 2014-08-04 15:10, Bart Visser wrote:
> Hi,
>
> Indeed, I'm on a Mac.
>
> When I try to set the lyrics or the title to something like "één lied", it becomes "←←n lied".
>
> The FinaleScript workaround is fine for the moment, but the less I have to use FinaleScript the better...
>
> Thanks,
>
>
> Bart
>
>
> Op 4 aug. 2014, om 15:06 heeft Jari Williamsson <jari.williamsson at mailbox.swipnet.se> het volgende geschreven:
>
>> Bart,
>>
>> It sounds like you are on the Mac? There's a known bug that code like the line below will produce garbage on the output console on the Mac:
>>
>> print ("ë")
>>
>>
>> I hope to fix that soon.
>>
>>
>> Best regards,
>>
>> Jari Williamsson
>>
>> On 2014-08-04 12:46, Bart Visser wrote:
>>> Hi all,
>>>
>>> Jari: thanks for the new beta-version. The require function works like a charm.
>>>
>>> I regularly have to use multi-byte characters (é, ë, etc.). Is there already a way to use them in JW Lua? In the PDK Framework there exists a function: SetUTF8String, but I'm not sure if it's already hooked up.
>>>
>>> My work-around at the moment is to run a FinaleScript to replace the characters that aren't supported by JW Lua.
>>>
>>> Thanks,
>>>
>>>
>>> Bart
>>> _______________________________________________
>>> JWLua mailing list
>>> JWLua at jwmusic.nu
>>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
More information about the JWLua
mailing list