From 026f0c26fedd2cd2b96ff9eca5ec7961956b3630 Mon Sep 17 00:00:00 2001
From: Hans Hagen
Requesting lower and uppercase codes:
@@ -684,35 +720,27 @@ characters.categories = allocate() local categories = characters.categories -- setmetatable(categories, { __index = function(t,u) if u then local c = data[u] c = c and c.category or u t[u] = c return c end end } ) -characters.lccodes = allocate() local lccodes = characters.lccodes -- lazy table -characters.uccodes = allocate() local uccodes = characters.uccodes -- lazy table -characters.shcodes = allocate() local shcodes = characters.shcodes -- lazy table +characters.lccodes = allocate() local lccodes = characters.lccodes -- lazy table +characters.uccodes = allocate() local uccodes = characters.uccodes -- lazy table +characters.shcodes = allocate() local shcodes = characters.shcodes -- lazy table -setmetatable(lccodes, { __index = function(t,u) if u then local c = data[u] c = c and c.lccode or u t[u] = c return c end end } ) -setmetatable(uccodes, { __index = function(t,u) if u then local c = data[u] c = c and c.uccode or u t[u] = c return c end end } ) -setmetatable(shcodes, { __index = function(t,u) if u then local c = data[u] c = c and c.shcode or u t[u] = c return c end end } ) +setmetatable(lccodes, { __index = function(t,u) if u then local c = data[u] c = c and c.lccode or (type(u) == "string" and utfbyte(u)) or u t[u] = c return c end end } ) +setmetatable(uccodes, { __index = function(t,u) if u then local c = data[u] c = c and c.uccode or (type(u) == "string" and utfbyte(u)) or u t[u] = c return c end end } ) +setmetatable(shcodes, { __index = function(t,u) if u then local c = data[u] c = c and c.shcode or (type(u) == "string" and utfbyte(u)) or u t[u] = c return c end end } ) characters.lcchars = allocate() local lcchars = characters.lcchars -- lazy table characters.ucchars = allocate() local ucchars = characters.ucchars -- lazy table characters.shchars = allocate() local shchars = characters.shchars -- lazy table -setmetatable(lcchars, { __index = function(t,u) if u then local c = data[utfbyte(u)] c = c and c.lccode c = c and utfchar (c) or u t[u] = c return c end end } ) -setmetatable(ucchars, { __index = function(t,u) if u then local c = data[utfbyte(u)] c = c and c.uccode c = c and utfchar (c) or u t[u] = c return c end end } ) -setmetatable(shchars, { __index = function(t,u) if u then local c = data[utfbyte(u)] c = c and c.shcode c = c and utfstring(c) or u t[u] = c return c end end } ) - ---~ characters.lccharcodes = allocate() local lccharcodes = characters.lccharcodes -- lazy table ---~ characters.uccharcodes = allocate() local uccharcodes = characters.uccharcodes -- lazy table ---~ characters.shcharcodes = allocate() local shcharcodes = characters.shcharcodes -- lazy table - ---~ setmetatable(lccharcodes, { __index = function(t,u) if u then local c = data[utfbyte(u)] c = c and c.lccode or u t[u] = c return c end end } ) ---~ setmetatable(uccharcodes, { __index = function(t,u) if u then local c = data[utfbyte(u)] c = c and c.uccode or u t[u] = c return c end end } ) ---~ setmetatable(shcharcodes, { __index = function(t,u) if u then local c = data[utfbyte(u)] c = c and c.shcode or u t[u] = c return c end end } ) +setmetatable(lcchars, { __index = function(t,u) if u then local c = data[u] c = c and c.lccode c = c and utfchar (c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } ) +setmetatable(ucchars, { __index = function(t,u) if u then local c = data[u] c = c and c.uccode c = c and utfchar (c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } ) +setmetatable(shchars, { __index = function(t,u) if u then local c = data[u] c = c and c.shcode c = c and utfstring(c) or (type(u) == "number" and utfchar(u)) or u t[u] = c return c end end } ) characters.specialchars = allocate() local specialchars = characters.specialchars -- lazy table setmetatable(specialchars, { __index = function(t,u) if u then - local c = data[utfbyte(u)] + local c = data[u] local s = c and c.specials if s then local tt, ttn = { }, 0 @@ -728,6 +756,9 @@ setmetatable(specialchars, { __index = function(t,u) t[u] = c return c else + if type(u) == "number" then + u = utfchar(u) + end t[u] = u return u end @@ -738,7 +769,7 @@ function characters.lower(str) local new, n = { }, 0 for u in utfvalues(str) do n = n + 1 - new[n] = utfchar(lccodes[u]) + new[n] = lcchars[u] end return concat(new) end @@ -747,18 +778,44 @@ function characters.upper(str) local new, n = { }, 0 for u in utfvalues(str) do n = n + 1 - new[n] = utfchar(uccodes[u]) + new[n] = ucchars[u] end return concat(new) end -function characters.lettered(str) +function characters.shaped(str) local new, n = { }, 0 for u in utfvalues(str) do - local d = data[u] - if is_letter[d.category] then - n = n + 1 - new[n] = utfchar(lccodes[u]) + n = n + 1 + new[n] = shchars[u] + end + return concat(new) +end + +function characters.lettered(str,spacing) + local new, n = { }, 0 + if spacing then + local done = false + for u in utfvalues(str) do + local c = data[u].category + if is_letter[c] then + if done and n > 1 then + n = n + 1 + new[n] = " " + done = false + end + n = n + 1 + new[n] = utfchar(u) + elseif spacing and is_spacing[c] then + done = true + end + end + else + for u in utfvalues(str) do + if is_letter[data[u].category] then + n = n + 1 + new[n] = utfchar(u) + end end end return concat(new) diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 6903ee474..ed43fb610 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.11.03 09:12} +\newcontextversion{2010.11.03 19:42} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index cec1133a4..bfd1b6119 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.11.03 09:12} +\edef\contextversion{2010.11.03 19:42} %D For those who want to use this: diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index 839930238..fcb330506 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -319,8 +319,6 @@ end node.free(lln) -- -- -- -- -- -- -- -- - - function nodeinjections.destination(width,height,depth,name,view) if trace_destinations then report_destinations("w=%s, h=%s, d=%s, n=%s, v=%s",width,height,depth,name,view or "no view") @@ -335,7 +333,7 @@ runners["inner"] = function(var,actions) local vir = var.i.references local internal = vir and vir.internal if internal then - var.inner = "aut:"..internal + var.inner = "aut:" .. internal end else var.inner = nil @@ -401,6 +399,7 @@ function specials.internal(var,actions) -- better resolve in strc-ref local v = references.internals[i] if not v then -- error + report_references("no internal reference '%s'",var.operation) elseif getinnermethod() == "names" then -- named return link(nil,nil,"aut:"..i,v.references.realpage,actions) diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index 5b8575219..2cf92bf67 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -99,8 +99,6 @@ local constants = sorters.constants local data, language, method, digits local replacements, m_mappings, z_mappings, p_mappings, entries, orders, lower, upper, method, sequence ---~ local shchars = characters.specialchars -- no specials for AE and ae - local mte = { __index = function(t,k) if k ~= "" and utfbyte(k) < digitsoffset then @@ -112,8 +110,8 @@ local mte = { if not el then local l = shchars[k] if l and l ~= k then - if #l > 0 then - l = sub(l,1,1) + if #l > 1 then + l = sub(l,1,1) -- todo end el = rawget(t,l) if not el then diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index 3dddc6bc5..c380fb4ea 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -1179,6 +1179,7 @@ function references.setinternalreference(prefix,tag,internal,view) end end if internal and innermethod == "names" then -- mixed or page + tn = tn + 1 t[tn] = "aut:" .. internal end local destination = references.mark(t,nil,nil,view) -- returns an attribute diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 6aa7e5aa0..2f3ad7e85 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/03/10 09:12:20 +-- merge date : 11/03/10 19:42:18 do -- begin closure to overcome local limits and interference -- cgit v1.2.3