[JW Lua] FCShapeDefInstructions:AddDrawChar uses signed unicode value, instead of unsigned

Jan Angermüller jan at angermueller.com
Fri Nov 27 01:23:43 CET 2015


Jari,

when writing a unicode value (>255) with 
FCShapeDefInstructions:AddDrawChar there seems to be an signed/unsigned 
value conversion somewhere. If I write for example the value 57424 
(=0xe050 unsigned), then afterwards I will read the value -8112 (=0xe050 
signed) and the created shape remains empty.
This is probably a problem in JW Lua, because when I read the value from 
a working Finale unicode shape (for example from a library import), I 
get the correct value 57424.

Below you find the code snippet. I shortened it for demonstration 
purposes. All other instructions necessary for creating the final shape 
were removed, but the result (i.e. the readable value) is the same as 
with the full code.
If you replace 57424 with an ascii value (for example the value 52 = 
number "4"), then the shape definition works fine and the "4" appears as 
a new shape (when using the full code).

Jan

local shapedef=finale.FCShapeDef()
local instructions=shapedef:CreateInstructions()
instructions:AddDrawChar(57424)   --if you replace this value with an 
ascii value (e.g. 52), then the print function below will print 52.
for i in each(instructions) do
     if i.Tag==25699 then -- =AddDrawChar tag
         print("Read Value",i:GetFourbyteData(0))   -- print -8112 
instead of 57424
     end
end





More information about the JWLua mailing list