diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-imp-effects.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-imp-effects.lua | 109 |
1 files changed, 66 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-imp-effects.lua b/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-imp-effects.lua index bd6cce87952..43ce82b71a6 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-imp-effects.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-imp-effects.lua @@ -215,62 +215,88 @@ local rules = { -- end -- end -local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze) - if delta ~= 0 then - for i=1,#rules do - local name = rules[i] - local value = mathparameters[name] - if value then - mathparameters[name] = (squeeze or 1) * (value + dx) +-- radicals are not yet ok + +local setmathparameters +local setmathcharacters + +if CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then + + setmathparameters = function(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) + if delta ~= 0 then + for i=1,#rules do + local name = rules[i] + local value = mathparameters[name] + if value then + mathparameters[name] = (squeeze or 1) * (value + dy) + end end end end -end -local function setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) + setmathcharacters = function() + end - local function wdpatch(char) - if wsnap ~= 0 then - char.width = char.width + wdelta/2 +else + + setmathparameters = function(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) + if delta ~= 0 then + for i=1,#rules do + local name = rules[i] + local value = mathparameters[name] + if value then + mathparameters[name] = (squeeze or 1) * (value + dy) + end + end end end - local function htpatch(char) - if hsnap ~= 0 then - local height = char.height - if height then - char.height = char.height + 2 * dy + setmathcharacters = function(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) + + -- still not the perfect rule + + local function wdpatch(char) + if wsnap ~= 0 then + char.width = char.width + wdelta/2 + end + end + + local function htpatch(char) + if hsnap ~= 0 then + local height = char.height + if height then + char.height = char.height + 2 * dy + end end end - end - local character = characters[0x221A] + local character = characters[0x221A] - if character and character.next then --- print("base char",0x221A,table.sequenced(character)) - local char = character - local next = character.next - wdpatch(char) - htpatch(char) - while next do - char = characters[next] + if character and character.next then + local char = character + local next = character.next wdpatch(char) htpatch(char) --- print("next char",next,table.sequenced(char)) - next = char.next - end - if char then - local v = char.vert_variants - if v then - local top = v[#v] - if top then - local char = characters[top.glyph] --- print("top char",top.glyph,table.sequenced(char)) - htpatch(char) + while next do + char = characters[next] + wdpatch(char) + htpatch(char) + next = char.next + end + if char then + local v = char.vert_variants + if v then + local top = v[#v] + if top then + local char = characters[top.glyph] + htpatch(char) + end end end end + end + end -- local show_effect = { "lua", function(f,c) @@ -278,10 +304,7 @@ end -- inspect(fonts.hashes.characters[f][c]) -- end } --- local show_effect = { "lua", "print('!')" } - ------ shiftmode = false -- test in mkiv and lmtx -local shiftmode = CONTEXTLMTXMODE > 0 +local shiftmode = CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 local function manipulateeffect(tfmdata) local effect = tfmdata.properties.effect @@ -358,7 +381,7 @@ local function manipulateeffect(tfmdata) end end if mathparameters then - setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze) + setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) end parameters.factor = factor |