summaryrefslogtreecommitdiff
path: root/tex/context/base/char-ini.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/char-ini.lua')
-rw-r--r--tex/context/base/char-ini.lua19
1 files changed, 12 insertions, 7 deletions
diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua
index d7a2044a2..95030da86 100644
--- a/tex/context/base/char-ini.lua
+++ b/tex/context/base/char-ini.lua
@@ -90,24 +90,29 @@ use the table. After all, we have this information available anyway.</p>
function characters.context.define()
local unicodes, utfcodes = characters.context.unicodes, characters.context.utfcodes
local flush, tc = tex.sprint, tex.ctxcatcodes
- for _, chr in pairs(characters.data) do
+ for u, chr in pairs(characters.data) do
local contextname = chr.contextname
if contextname then
-- by this time, we're still in normal catcode mode
- if chr.unicodeslot < 128 then
- flush(tc, "\\chardef\\" .. contextname .. "=" .. unicodes[contextname])
- else
- flush(tc, "\\let\\" .. contextname .. "=" .. utfcodes[contextname])
- end
+ if chr.unicodeslot < 128 then
+ flush(tc, "\\chardef\\" .. contextname .. "=" .. u) -- unicodes[contextname])
+ else
+ flush(tc, "\\let\\" .. contextname .. "=" .. utf.char(u)) -- utfcodes[contextname])
+ end
end
end
end
+function characters.charcode(box)
+ local b = tex.box[box]
+ local l = b.list
+ tex.sprint((l and l.id == node.id('glyph') and l.char) or 0)
+end
+
--[[ldx--
<p>Setting the lccodes is also done in a loop over the data table.</p>
--ldx]]--
-
function characters.setcodes()
local flush, tc = tex.sprint, tex.ctxcatcodes
for code, chr in pairs(characters.data) do