summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-11-14 01:00:14 +0200
committerMarius <mariausol@gmail.com>2011-11-14 01:00:14 +0200
commit9671aae0a69df33d2a832de35eab0f143fc3b55b (patch)
treef720944d3b4792eb6f8b068110a72667de406ea6 /tex/generic
parentdab6ca5e4c89c50592aa95482057ee90501ae7f6 (diff)
downloadcontext-9671aae0a69df33d2a832de35eab0f143fc3b55b.tar.gz
beta 2011.11.13 23:53
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua52
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