diff options
author | Marius <mariausol@gmail.com> | 2011-09-06 15:20:14 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-09-06 15:20:14 +0300 |
commit | 311faa1da1996add3764a3662e3273276bf8a213 (patch) | |
tree | 616bc1714c4329091d716e4654d7afdb5bc868a9 /tex/context/base/font-otn.lua | |
parent | bacc6b247ea105554e09ff5071211bc5366c4e39 (diff) | |
download | context-311faa1da1996add3764a3662e3273276bf8a213.tar.gz |
beta 2011.09.06 14:02
Diffstat (limited to 'tex/context/base/font-otn.lua')
-rw-r--r-- | tex/context/base/font-otn.lua | 71 |
1 files changed, 33 insertions, 38 deletions
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 0cbdea839..a972d50e7 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -901,33 +901,6 @@ end local logwarning = report_subchain -function chainmores.chainsub(start,stop,kind,chainname,currentcontext,lookuphash,lookuplist,chainlookupname,n) - logprocess("%s: a direct call to chainsub cannot happen",cref(kind,chainname,chainlookupname)) - return start, false -end - --- handled later: --- --- function chainmores.gsub_single(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) --- return chainprocs.gsub_single(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) --- end - -function chainmores.gsub_multiple(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) - logprocess("%s: gsub_multiple not yet supported",cref(kind,chainname,chainlookupname)) - return start, false -end - -function chainmores.gsub_alternate(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) - logprocess("%s: gsub_alternate not yet supported",cref(kind,chainname,chainlookupname)) - return start, false -end - --- handled later: --- --- function chainmores.gsub_ligature(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) --- return chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) --- end - local function logprocess(...) if trace_steps then registermessage(...) @@ -945,6 +918,11 @@ function chainprocs.chainsub(start,stop,kind,chainname,currentcontext,lookuphash return start, false end +function chainmores.chainsub(start,stop,kind,chainname,currentcontext,lookuphash,lookuplist,chainlookupname,n) + logprocess("%s: a direct call to chainsub cannot happen",cref(kind,chainname,chainlookupname)) + return start, false +end + -- The reversesub is a special case, which is why we need to store the replacements -- in a bit weird way. There is no lookup and the replacement comes from the lookup -- itself. It is meant mostly for dealing with Urdu. @@ -1057,7 +1035,7 @@ the match.</p> --ldx]]-- function chainprocs.gsub_multiple(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) - delete_till_stop(start,stop) + delete_till_stop(start,stop) -- we can assume that marks are to be deleted local startchar = start.char local subtables = currentlookup.subtables local lookupname = subtables[1] @@ -1082,39 +1060,49 @@ function chainprocs.gsub_multiple(start,stop,kind,chainname,currentcontext,looku return start, false end +-- function chainmores.gsub_multiple(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) +-- logprocess("%s: gsub_multiple not yet supported",cref(kind,chainname,chainlookupname)) +-- return start, false +-- end + +chainmores.gsub_multiple = chainprocs.gsub_multiple + --[[ldx-- <p>Here we replace start by new glyph. First we delete the rest of the match.</p> --ldx]]-- +-- char_1 mark_1 -> char_x mark_1 (ignore marks) +-- char_1 mark_1 -> char_x + +-- to be checked: do we always have just one glyph? +-- we can also have alternates for marks +-- marks come last anyway +-- are there cases where we need to delete the mark + function chainprocs.gsub_alternate(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname) - -- todo: marks ? - local n = delete_till_stop(start,stop) local current = start local subtables = currentlookup.subtables - local m = 0 while current do - if current.id == glyph_code then - m = m + 1 + if current.id == glyph_code then -- is this check needed? local currentchar = current.char local lookupname = subtables[1] local alternatives = lookuphash[lookupname] if not alternatives then if trace_bugs then - logwarning("%s: %s of %s, no alternative hit",cref(kind,chainname,chainlookupname,lookupname),m,n) + logwarning("%s: no alternative hit",cref(kind,chainname,chainlookupname,lookupname)) end else alternatives = alternatives[currentchar] if not alternatives then if trace_bugs then - logwarning("%s: %s of %s, no alternative for %s",cref(kind,chainname,chainlookupname,lookupname),m,n,gref(currentchar)) + logwarning("%s: no alternative for %s",cref(kind,chainname,chainlookupname,lookupname),gref(currentchar)) end else local choice, index = alternative_glyph(current,alternatives,kind,chainname,chainlookupname,lookupname) current.char = choice if trace_alternatives then - m = m + 1 - logprocess("%s: %s of %s, replacing single %s by alternative %s (%s)", - cref(kind,chainname,chainlookupname,lookupname),m,n,index,gref(currentchar),gref(choice)) + logprocess("%s: replacing single %s by alternative %s (%s)", + cref(kind,chainname,chainlookupname,lookupname),index,gref(currentchar),gref(choice)) end end end @@ -1128,6 +1116,13 @@ function chainprocs.gsub_alternate(start,stop,kind,chainname,currentcontext,look return start, false end +-- function chainmores.gsub_alternate(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n) +-- logprocess("%s: gsub_alternate not yet supported",cref(kind,chainname,chainlookupname)) +-- return start, false +-- end + +chainmores.gsub_alternate = chainprocs.gsub_alternate + --[[ldx-- <p>When we replace ligatures we use a helper that handles the marks. I might change this function (move code inline and handle the marks by a separate function). We |