diff options
Diffstat (limited to 'tex/context/base/mkiv/font-imp-effects.lua')
-rw-r--r-- | tex/context/base/mkiv/font-imp-effects.lua | 172 |
1 files changed, 66 insertions, 106 deletions
diff --git a/tex/context/base/mkiv/font-imp-effects.lua b/tex/context/base/mkiv/font-imp-effects.lua index 43ce82b71..27a16914b 100644 --- a/tex/context/base/mkiv/font-imp-effects.lua +++ b/tex/context/base/mkiv/font-imp-effects.lua @@ -207,94 +207,63 @@ local rules = { "UnderbarRuleThickness", } --- local commands = char.commands --- if commands then --- local command = commands[1] --- if command and command[1] == "right" then --- commands[1] = rightcommand[command[2]-snap] --- end --- end - -- 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 +local function setmathparameters(tfmdata,characters,mathparameters,dx,dy,squeeze,multiplier) + -- hm, this was "if delta ~= 0 then" but delta was gone + if dy ~= 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 - setmathcharacters = function() - end +local function setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze,wdelta,hdelta,ddelta) -else + -- still not the perfect rule - 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 + local function wdpatch(char) + if wsnap ~= 0 then + char.width = char.width + wdelta/2 end end - 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 + local function htpatch(char) + if hsnap ~= 0 then + local height = char.height + if height then + char.height = char.height + 2 * dy end end + end - local character = characters[0x221A] + local character = characters[0x221A] - if character and character.next then - local char = character - local next = character.next + if character and character.next then + local char = character + local next = character.next + wdpatch(char) + htpatch(char) + while next do + char = characters[next] wdpatch(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 + 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 @@ -304,8 +273,6 @@ end -- inspect(fonts.hashes.characters[f][c]) -- end } -local shiftmode = CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 - local function manipulateeffect(tfmdata) local effect = tfmdata.properties.effect if effect then @@ -327,49 +294,42 @@ local function manipulateeffect(tfmdata) local factor = (1 + effect.factor) * factor local hfactor = (1 + effect.hfactor) * hfactor local vfactor = (1 + effect.vfactor) * vfactor - if shiftmode then - parameters.hshift = hshift - parameters.vshift = vshift - else - vshift = vshift ~= 0 and upcommand[vshift] or false - hshift = rightcommand[hshift] - end + vshift = vshift ~= 0 and upcommand[vshift] or false + hshift = rightcommand[hshift] for unicode, character in next, characters do local oldwidth = character.width local oldheight = character.height local olddepth = character.depth if oldwidth and oldwidth > 0 then character.width = oldwidth + wdelta - if not shiftmode then - local commands = character.commands - if vshift then - if commands then - prependcommands ( commands, - -- show_effect, - hshift, - vshift - ) - else - character.commands = { - -- show_effect, - hshift, - vshift, - charcommand[unicode] - } - end + local commands = character.commands + if vshift then + if commands then + prependcommands ( commands, + -- show_effect, + hshift, + vshift + ) + else + character.commands = { + -- show_effect, + hshift, + vshift, + charcommand[unicode] + } + end + else + if commands then + prependcommands ( commands, + -- show_effect, + hshift + ) else - if commands then - prependcommands ( commands, - -- show_effect, - hshift - ) - else - character.commands = { - -- show_effect, - hshift, - charcommand[unicode] - } - end + character.commands = { + -- show_effect, + hshift, + charcommand[unicode] + } end end end |