From 8114597629901975313c670cf46e374e8052cd52 Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 22 Jan 2013 20:00:20 +0200 Subject: beta 2013.01.22 18:33 --- tex/generic/context/luatex/luatex-fonts-merged.lua | 102 ++++++++++++--------- 1 file changed, 61 insertions(+), 41 deletions(-) (limited to 'tex/generic') diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 0b714c1a7..7b2b0a282 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 01/21/13 18:18:50 +-- merge date : 01/22/13 18:33:20 do -- begin closure to overcome local limits and interference @@ -949,7 +949,6 @@ function string.is_empty(str) end end - -- if not string.escapedpattern then -- -- local patterns_escapes = { @@ -5794,7 +5793,7 @@ local otf = fonts.handlers.otf otf.glists = { "gsub", "gpos" } -otf.version = 2.738 -- beware: also sync font-mis.lua +otf.version = 2.740 -- beware: also sync font-mis.lua otf.cache = containers.define("fonts", "otf", otf.version, true) local fontdata = fonts.hashes.identifiers @@ -9014,19 +9013,40 @@ local registerotffeature = otffeatures.register process features right.

--ldx]]-- -analyzers.constants = { - init = 1, - medi = 2, - fina = 3, - isol = 4, - -- devanagari - rphf = 5, - half = 6, - pref = 7, - blwf = 8, - pstf = 9, +-- never use these numbers directly + +local s_init = 1 local s_rphf = 7 +local s_medi = 2 local s_half = 8 +local s_fina = 3 local s_pref = 9 +local s_isol = 4 local s_blwf = 10 +local s_mark = 5 local s_pstf = 11 +local s_rest = 6 + +local states = { + init = s_init, + medi = s_medi, + fina = s_fina, + isol = s_isol, + mark = s_mark, + rest = s_rest, + rphf = s_rphf, + half = s_half, + pref = s_pref, + blwf = s_blwf, + pstf = s_pstf, +} + +local features = { + init = s_init, + medi = s_medi, + fina = s_fina, + isol = s_isol, + -- mark = s_mark, } +analyzers.states = states +analyzers.features = features + -- todo: analyzers per script/lang, cross font, so we need an font id hash -> script -- e.g. latin -> hyphenate, arab -> 1/2/3 analyze -- its own namespace @@ -9044,40 +9064,40 @@ function analyzers.setstate(head,font) if d then if d.class == "mark" or (useunicodemarks and categories[char] == "mn") then done = true - current[a_state] = 5 -- mark + current[a_state] = s_mark elseif n == 0 then first, last, n = current, current, 1 - current[a_state] = 1 -- init + current[a_state] = s_init else last, n = current, n+1 - current[a_state] = 2 -- medi + current[a_state] = s_medi end else -- finish if first and first == last then - last[a_state] = 4 -- isol + last[a_state] = s_isol elseif last then - last[a_state] = 3 -- fina + last[a_state] = s_fina end first, last, n = nil, nil, 0 end elseif id == disc_code then -- always in the middle - current[a_state] = 2 -- midi + current[a_state] = s_midi last = current else -- finish if first and first == last then - last[a_state] = 4 -- isol + last[a_state] = s_isol elseif last then - last[a_state] = 3 -- fina + last[a_state] = s_fina end first, last, n = nil, nil, 0 end current = current.next end if first and first == last then - last[a_state] = 4 -- isol + last[a_state] = s_isol elseif last then - last[a_state] = 3 -- fina + last[a_state] = s_fina end return head, done end @@ -9239,19 +9259,19 @@ local function finish(first,last) if first == last then local fc = first.char if isol_fina_medi_init[fc] or isol_fina[fc] then - first[a_state] = 4 -- isol + first[a_state] = s_isol else warning(first,"isol") - first[a_state] = 0 -- error + first[a_state] = s_error end else local lc = last.char if isol_fina_medi_init[lc] or isol_fina[lc] then -- why isol here ? -- if laststate == 1 or laststate == 2 or laststate == 4 then - last[a_state] = 3 -- fina + last[a_state] = s_fina else warning(last,"fina") - last[a_state] = 0 -- error + last[a_state] = s_error end end first, last = nil, nil @@ -9259,10 +9279,10 @@ local function finish(first,last) -- first and last are either both set so we never com here local fc = first.char if isol_fina_medi_init[fc] or isol_fina[fc] then - first[a_state] = 4 -- isol + first[a_state] = s_isol else warning(first,"isol") - first[a_state] = 0 -- error + first[a_state] = s_error end first = nil end @@ -9279,33 +9299,33 @@ function methods.arab(head,font,attr) -- maybe make a special version with no tr done = true local char = current.char if marks[char] or (useunicodemarks and categories[char] == "mn") then - current[a_state] = 5 -- mark + current[a_state] = s_mark elseif isol[char] then -- can be zwj or zwnj too first, last = finish(first,last) - current[a_state] = 4 -- isol + current[a_state] = s_isol first, last = nil, nil elseif not first then if isol_fina_medi_init[char] then - current[a_state] = 1 -- init + current[a_state] = s_init first, last = first or current, current elseif isol_fina[char] then - current[a_state] = 4 -- isol + current[a_state] = s_isol first, last = nil, nil else -- no arab first, last = finish(first,last) end elseif isol_fina_medi_init[char] then first, last = first or current, current - current[a_state] = 2 -- medi + current[a_state] = s_medi elseif isol_fina[char] then - if not last[a_state] == 1 then + if not last[a_state] == s_init then -- tricky, we need to check what last may be ! - last[a_state] = 2 -- medi + last[a_state] = s_medi end - current[a_state] = 3 -- fina + current[a_state] = s_fina first, last = nil, nil elseif char >= 0x0600 and char <= 0x06FF then - current[a_state] = 6 -- rest + current[a_state] = s_rest first, last = finish(first,last) else --no first, last = finish(first,last) @@ -11347,7 +11367,7 @@ end) -- fonts.hashes.lookups = lookuphashes -local constants = fonts.analyzers.constants +local autofeatures = fonts.analyzers.features -- was: constants local function initialize(sequence,script,language,enabled) local features = sequence.features @@ -11357,7 +11377,7 @@ local function initialize(sequence,script,language,enabled) if valid then local languages = scripts[script] or scripts[wildcard] if languages and (languages[language] or languages[wildcard]) then - return { valid, constants[kind] or false, sequence.chain or 0, kind, sequence } + return { valid, autofeatures[kind] or false, sequence.chain or 0, kind, sequence } end end end -- cgit v1.2.3