[JW Lua] FCString:CreateEnigmaComponents does not separate font changes

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Wed Mar 25 19:39:23 CET 2015


Jan,

Use CreateEnigmaStrings() instead, like this:
---
local text=finale.FCString()
text.LuaString="^fontTxt(Times New Roman,4096)^size(12)^nfx(2)sub. 
^fontMus(Font0,0)^size(24)^nfx(0)p"
local splittext=text:CreateEnigmaStrings(true)
for i in each(splittext) do
     if (i:IsEnigmaCommand()) then
         local components = i:CreateEnigmaComponents()
         for c in each(components) do
             print(c.LuaString)
         end
     end
end
---

I'll modify CreateEnigmaComponents() to make sure it fails if it gets a 
full raw string as a parameter.


Best regards,

Jari Williamsson



On 2015-03-25 17:16, Jan Angermüller wrote:
> Jari,
>
> FCString:CreateEnigmaComponents does not split font changes within a
> string correctly (for example "sub. p").
> See script and output below.
>
> All the best,
> Jan
>
>
> local text=finale.FCString()
> text.LuaString="^fontTxt(Times New Roman,4096)^size(12)^nfx(2)sub.
> ^fontMus(Font0,0)^size(24)^nfx(0)p"
> local splittext=text:CreateEnigmaComponents()
> for i in each(splittext) do
>      print(i.LuaString)
> end
>
>
> Output:
>
> Running [Unnamed Script] ======>
> fontTxt
> Times New Roman
> 4096
> ^size
> 12
> ^nfx
> 2
> sub. ^fontMus *-- new font tag *detected, but not split correctly to a
> new string
> Font0
> 0
> ^size
> 24
> ^nfx
> 0
> p
> <======= [Unnamed Script] succeeded (Processing time: 0.000 s).
>
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>






More information about the JWLua mailing list