diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-01-05 19:27:25 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-01-05 19:27:25 +0100 |
commit | 8faafb7250a84be6f1d96be67cbbe27d500d3b47 (patch) | |
tree | 775abb16e550075b2993863e828412e3f06c59ae /tex/generic | |
parent | 2653bbd48f47c80579c28e2df1a456e0d9fad428 (diff) | |
download | context-8faafb7250a84be6f1d96be67cbbe27d500d3b47.tar.gz |
beta 2011.11.13 23:53
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 928b9c2d5..8a951089c 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 : 11/12/11 12:34:20 +-- merge date : 11/13/11 23:53:45 do -- begin closure to overcome local limits and interference @@ -8892,11 +8892,11 @@ function handlers.gsub_single(start,kind,lookupname,replacement) return start, true end -local function set_alternative_glyph(start,alternatives,kind,chainname,chainlookupname,lookupname) -- chainname and chainlookupname optional +local function get_alternative_glyph(start,alternatives,value) -- needs checking: (global value, brrr) - local value = featurevalue == true and tfmdata.shared.features[kind] or featurevalue local choice = nil local n = #alternatives + local char = start.char -- if value == "random" then local r = random(1,n) @@ -8919,30 +8919,14 @@ local function set_alternative_glyph(start,alternatives,kind,chainname,chainlook value, choice = format("no %s variants, ignoring",value), false end elseif value == 0 then - value, choice = format("choice %s (no change)",value), start.char + value, choice = format("choice %s (no change)",value), char elseif value < 1 then value, choice = format("no %s variants, taking %s",value,1), alternatives[1] else value, choice = format("choice %s",value), alternatives[value] end end - if trace_alternatives then - if choice then - logprocess("%s: replacing %s by alternative %s (%s)",pref(kind,lookupname),gref(start.char),gref(choice),index) - else - logwarning("%s: no variant %s for %s",cref(kind,chainname,chainlookupname,lookupname),value,gref(start.char)) - end - end - if choice then - start.char = choice - if trace_alternatives then - logprocess("%s: replacing %s by alternative %s (%s)",pref(kind,lookupname),gref(start.char),gref(choice),index) - end - else - if trace_alternatives then - logwarning("%s: no variant %s for %s",cref(kind,chainname,chainlookupname,lookupname),value,gref(start.char)) - end - end + return choice end local function multiple_glyphs(start,multiple) -- marks ? @@ -8973,7 +8957,18 @@ local function multiple_glyphs(start,multiple) -- marks ? end function handlers.gsub_alternate(start,kind,lookupname,alternative,sequence) - set_alternative_glyph(start,alternative,kind,lookupname) + local value = featurevalue == true and tfmdata.shared.features[kind] or featurevalue + local choice = get_alternative_glyph(start,alternative,value) + if choice then + if trace_alternatives then + logprocess("%s: replacing %s by alternative %s (%s)",pref(kind,lookupname),gref(char),gref(choice),choice) + end + start.char = choice + else + if trace_alternatives then + logwarning("%s: no variant %s for %s",pref(kind,lookupname),tostring(value),gref(char)) + end + end return start, true end @@ -9574,6 +9569,7 @@ chainmores.gsub_multiple = chainprocs.gsub_multiple function chainprocs.gsub_alternate(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) local current = start local subtables = currentlookup.subtables + local value = featurevalue == true and tfmdata.shared.features[kind] or featurevalue while current do if current.id == glyph_code then -- is this check needed? local currentchar = current.char @@ -9586,7 +9582,17 @@ function chainprocs.gsub_alternate(start,stop,kind,chainname,currentcontext,look else alternatives = alternatives[currentchar] if alternatives then - set_alternative_glyph(current,alternatives,kind,chainname,chainlookupname,lookupname) + local choice = get_alternative_glyph(current,alternatives,value) + if choice then + if trace_alternatives then + logprocess("%s: replacing %s by alternative %s (%s)",cref(kind,chainname,chainlookupname,lookupname),gref(char),gref(choice),choice) + end + start.char = choice + else + if trace_alternatives then + logwarning("%s: no variant %s for %s",cref(kind,chainname,chainlookupname,lookupname),tostring(value),gref(char)) + end + end elseif trace_bugs then logwarning("%s: no alternative for %s",cref(kind,chainname,chainlookupname,lookupname),gref(currentchar)) end |