Fix T1 to T2 charstring conversion for stem3 (Needs more testing)

This commit is contained in:
Marcel Fabian Krüger 2021-11-07 15:46:56 +01:00
parent 1434922804
commit 285414dd23

View File

@ -258,8 +258,15 @@ local function adjust_charstring(cs) -- Here we get a not yet optimized but pars
local i = 1 local i = 1
while cs[i] ~= nil do while cs[i] ~= nil do
if cs[i] and cs[i].idx then if cs[i] and cs[i].idx then
for l = 1, math.floor((j + 7)/8) do if stem3[2] then
bytes[l] = 0 local s3 = stem3[2]
for l = 1, math.floor((j + 7)/8) do
bytes[l] = string.byte(s3, l)
end
else
for l = 1, math.floor((j + 7)/8) do
bytes[l] = 0
end
end end
while (cs[i] or {}).idx do while (cs[i] or {}).idx do
local idx = cs[i].idx-1 local idx = cs[i].idx-1
@ -267,10 +274,6 @@ local function adjust_charstring(cs) -- Here we get a not yet optimized but pars
cs[i] = false cs[i] = false
i = i+1 i = i+1
end end
for l = 2, #stem3 do
local idx = stem3[l].idx-1
bytes[math.floor(idx/8) + 1] = bytes[math.floor(idx/8) + 1] | (1<<(7-idx%8))
end
i = i-1 i = i-1
cs[i] = {19, string.char(table.unpack(bytes))} cs[i] = {19, string.char(table.unpack(bytes))}
end end