From 285414dd23f8dc10510dae1d1b49011bcd0f8d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Sun, 7 Nov 2021 15:46:56 +0100 Subject: [PATCH] Fix T1 to T2 charstring conversion for stem3 (Needs more testing) --- luametalatex-font-t1tot2.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/luametalatex-font-t1tot2.lua b/luametalatex-font-t1tot2.lua index d034298..aa2eb9f 100644 --- a/luametalatex-font-t1tot2.lua +++ b/luametalatex-font-t1tot2.lua @@ -258,8 +258,15 @@ local function adjust_charstring(cs) -- Here we get a not yet optimized but pars local i = 1 while cs[i] ~= nil do if cs[i] and cs[i].idx then - for l = 1, math.floor((j + 7)/8) do - bytes[l] = 0 + if stem3[2] then + 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 while (cs[i] or {}).idx do 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 i = i+1 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 cs[i] = {19, string.char(table.unpack(bytes))} end