Skip to content
This repository has been archived by the owner on Aug 17, 2019. It is now read-only.

Commit

Permalink
[fontloader] revert features handler temporarily
Browse files Browse the repository at this point in the history
Address issue lualatex#318

This reverts the changes made to font-otn.lua with commit adc43c3c24..

Certain features related to directionality are not handled correctly
with the most recent fontloader. As a temporary measure, revert the
handling code in font-otn.lua and restore the values it references.
While this appears to suppress the issue, we’ll switch back to the
upstream code once we have an actual solution.
  • Loading branch information
phi-gamma committed Jan 21, 2016
1 parent 95c68d6 commit a65f049
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 8 deletions.
9 changes: 3 additions & 6 deletions src/fontloader/misc/fontloader-basics-nod.lua
Expand Up @@ -51,22 +51,19 @@ nodes = { }
nodes.pool = { }
nodes.handlers = { }

local nodecodes = { }
local nodecodes = { } for k,v in next, node.types () do nodecodes[string.gsub(v,"_","")] = k end
local whatcodes = { } for k,v in next, node.whatsits() do whatcodes[string.gsub(v,"_","")] = k end
local glyphcodes = node.subtypes("glyph")
local disccodes = node.subtypes("disc")

for k, v in next, node.types() do
v = string.gsub(v,"_","")
nodecodes[k] = v
nodecodes[v] = k
end
for i=0,#glyphcodes do
glyphcodes[glyphcodes[i]] = i
end
for i=0,#disccodes do
disccodes[disccodes[i]] = i
end

nodes.whatcodes = whatcodes
nodes.nodecodes = nodecodes
nodes.glyphcodes = glyphcodes
nodes.disccodes = disccodes
Expand Down
67 changes: 65 additions & 2 deletions src/fontloader/misc/fontloader-font-otn.lua
Expand Up @@ -246,16 +246,18 @@ local zwj = 0x200D
local wildcard = "*"
local default = "dflt"
local whatcodes = nodes.whatcodes
local nodecodes = nodes.nodecodes
local glyphcodes = nodes.glyphcodes
local disccodes = nodes.disccodes
local glyph_code = nodecodes.glyph
local glue_code = nodecodes.glue
local disc_code = nodecodes.disc
local whatsit_code = nodecodes.whatsit
local math_code = nodecodes.math
local dir_code = nodecodes.dir
local localpar_code = nodecodes.localpar
local dir_code = nodecodes.dir or whatcodes.dir
local localpar_code = nodecodes.localpar or whatcodes.localpar
local discretionary_code = disccodes.discretionary
local ligature_code = glyphcodes.ligature
Expand Down Expand Up @@ -3358,6 +3360,37 @@ local function featuresprocessor(head,font,attr)
comprun(start,c_run)
start = getnext(start)
end
elseif id == whatsit_code then
local subtype = getsubtype(start)
if subtype == dir_code then
local dir = getfield(start,"dir")
if dir == "+TLT" then
topstack = topstack + 1
dirstack[topstack] = dir
rlmode = 1
elseif dir == "+TRT" then
topstack = topstack + 1
dirstack[topstack] = dir
rlmode = -1
elseif dir == "-TLT" or dir == "-TRT" then
topstack = topstack - 1
rlmode = dirstack[topstack] == "+TRT" and -1 or 1
else
rlmode = rlparmode
end
elseif subtype == localpar_code then
local dir = getfield(start,"dir")
if dir == "TRT" then
rlparmode = -1
elseif dir == "TLT" then
rlparmode = 1
else
rlparmode = 0
end
-- one might wonder if the par dir should be looked at, so we might as well drop the n
rlmode = rlparmode
end
start = getnext(start)
elseif id == math_code then
start = getnext(end_of_math(start))
elseif id == dir_code then
Expand Down Expand Up @@ -3628,6 +3661,36 @@ local function featuresprocessor(head,font,attr)
comprun(start,c_run)
start = getnext(start)
end
elseif id == whatsit_code then
local subtype = getsubtype(start)
if subtype == dir_code then
local dir = getfield(start,"dir")
if dir == "+TLT" then
topstack = topstack + 1
dirstack[topstack] = dir
rlmode = 1
elseif dir == "+TRT" then
topstack = topstack + 1
dirstack[topstack] = dir
rlmode = -1
elseif dir == "-TLT" or dir == "-TRT" then
topstack = topstack - 1
rlmode = dirstack[topstack] == "+TRT" and -1 or 1
else
rlmode = rlparmode
end
elseif subtype == localpar_code then
local dir = getfield(start,"dir")
if dir == "TRT" then
rlparmode = -1
elseif dir == "TLT" then
rlparmode = 1
else
rlparmode = 0
end
rlmode = rlparmode
end
start = getnext(start)
elseif id == math_code then
start = getnext(end_of_math(start))
elseif id == dir_code then
Expand Down

0 comments on commit a65f049

Please sign in to comment.