diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-01-22 00:51:55 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-01-22 00:51:55 +0100 |
commit | 7b982d37f58b36e8d8dd2580893e89430c576ca9 (patch) | |
tree | f3f5944bace136a2c878c82fd2bc882fc9a5ce42 /src/fontloader/misc | |
parent | 07cc29d8658360e9e6ddecf7f251e518b9ea99c9 (diff) | |
parent | 55799dad5b8a2716aea1cfee28b4ce093e587f8a (diff) | |
download | luaotfload-7b982d37f58b36e8d8dd2580893e89430c576ca9.tar.gz |
Merge pull request #320 from phi-gamma/master
fixes
Diffstat (limited to 'src/fontloader/misc')
-rw-r--r-- | src/fontloader/misc/fontloader-basics-nod.lua | 9 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-otf.lua | 17 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-font-otn.lua | 70 | ||||
-rw-r--r-- | src/fontloader/misc/fontloader-l-lpeg.lua | 2 |
4 files changed, 76 insertions, 22 deletions
diff --git a/src/fontloader/misc/fontloader-basics-nod.lua b/src/fontloader/misc/fontloader-basics-nod.lua index 78f1b17..95a1744 100644 --- a/src/fontloader/misc/fontloader-basics-nod.lua +++ b/src/fontloader/misc/fontloader-basics-nod.lua @@ -51,15 +51,11 @@ 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 @@ -67,6 +63,7 @@ for i=0,#disccodes do disccodes[disccodes[i]] = i end +nodes.whatcodes = whatcodes nodes.nodecodes = nodecodes nodes.glyphcodes = glyphcodes nodes.disccodes = disccodes diff --git a/src/fontloader/misc/fontloader-font-otf.lua b/src/fontloader/misc/fontloader-font-otf.lua index 0471c17..e90ec73 100644 --- a/src/fontloader/misc/fontloader-font-otf.lua +++ b/src/fontloader/misc/fontloader-font-otf.lua @@ -287,7 +287,6 @@ local ordered_enhancers = { "check glyphs", "check metadata", --- "check extra features", -- after metadata "prepare tounicode", @@ -296,7 +295,6 @@ local ordered_enhancers = { "expand lookups", -- a temp hack awaiting the lua loader ---[[phg-- PATCH: Next line restores font features --phg]]-- "check extra features", -- after metadata and duplicates "cleanup tables", @@ -601,9 +599,6 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone applyruntimefixes(filename,data) end enhance("add dimensions",data,filename,nil,false) ---[[phg-- This was hand-patched to restore the fontloader -enhance("check extra features",data,filename) ---phg]]-- if trace_sequences then showfeatureorder(data,filename) end @@ -2955,11 +2950,13 @@ end otf.coverup = { stepkey = "subtables", actions = { - substitution = justset, - alternate = justset, - multiple = justset, - ligature = justset, - kern = justset, + substitution = justset, + alternate = justset, + multiple = justset, + ligature = justset, + kern = justset, + chainsubstitution = justset, + chainposition = justset, }, register = function(coverage,lookuptype,format,feature,n,descriptions,resources) local name = formatters["ctx_%s_%s_%s"](feature,lookuptype,n) -- we can have a mix of types diff --git a/src/fontloader/misc/fontloader-font-otn.lua b/src/fontloader/misc/fontloader-font-otn.lua index b48aea7..081630a 100644 --- a/src/fontloader/misc/fontloader-font-otn.lua +++ b/src/fontloader/misc/fontloader-font-otn.lua @@ -246,6 +246,7 @@ local zwj = 0x200D local wildcard = "*" local default = "dflt" +local whatcodes = nodes.whatcodes local nodecodes = nodes.nodecodes local glyphcodes = nodes.glyphcodes local disccodes = nodes.disccodes @@ -253,9 +254,10 @@ 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 @@ -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 @@ -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 @@ -3894,9 +3957,6 @@ local function prepare_contextchains(tfmdata) sequence[nofsequences] = after[n] end end ---[[phg-- Hard patch: This crashes, see https://github.com/lualatex/luaotfload/issues/303 - if sequence[1] then ---phg]]-- if sequence[start] then -- Replacements only happen with reverse lookups as they are single only. We -- could pack them into current (replacement value instead of true) and then diff --git a/src/fontloader/misc/fontloader-l-lpeg.lua b/src/fontloader/misc/fontloader-l-lpeg.lua index 5be1246..959ca55 100644 --- a/src/fontloader/misc/fontloader-l-lpeg.lua +++ b/src/fontloader/misc/fontloader-l-lpeg.lua @@ -110,7 +110,7 @@ local underscore = P("_") local hexdigit = digit + lowercase + uppercase local cr, lf, crlf = P("\r"), P("\n"), P("\r\n") ----- newline = crlf + S("\r\n") -- cr + lf -local newline = P("\r") * (P("\n") + P(true)) + P("\n") +local newline = P("\r") * (P("\n") + P(true)) + P("\n") -- P("\r")^-1 * P("\n")^-1 local escaped = P("\\") * anything local squote = P("'") local dquote = P('"') |