summaryrefslogtreecommitdiff
path: root/tex/context/base/spac-chr.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-06-15 13:00:13 +0300
committerMarius <mariausol@gmail.com>2011-06-15 13:00:13 +0300
commit776071a1ec8278bcd8cbcf92cb1e5507bcac14d2 (patch)
treee22cab2d01d20ee59ad05a213eb70cf3c13091dd /tex/context/base/spac-chr.lua
parentfaaa984b45c82f7345e0a8daf457685feae54dcc (diff)
downloadcontext-776071a1ec8278bcd8cbcf92cb1e5507bcac14d2.tar.gz
beta 2011.06.15 11:49
Diffstat (limited to 'tex/context/base/spac-chr.lua')
-rw-r--r--tex/context/base/spac-chr.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/tex/context/base/spac-chr.lua b/tex/context/base/spac-chr.lua
index 601b90645..9771ad2e8 100644
--- a/tex/context/base/spac-chr.lua
+++ b/tex/context/base/spac-chr.lua
@@ -6,11 +6,11 @@ if not modules then modules = { } end modules ['spac-chr'] = {
license = "see context related readme files"
}
-local byte = string.byte
+local byte, lower = string.byte, string.lower
------ trace_characters = false trackers.register("typesetters.characters", function(v) trace_characters = v end)
------
------ report_characters = logs.reporter("typesetting","characters")
+trace_characters = false trackers.register("typesetters.characters", function(v) trace_characters = v end)
+
+report_characters = logs.reporter("typesetting","characters")
local nodes, node = nodes, node
@@ -27,6 +27,8 @@ local new_glue = nodepool.glue
local nodecodes = nodes.nodecodes
local glyph_code = nodecodes.glyph
+local chardata = characters.data
+
local typesetters = typesetters
local characters = { }
@@ -62,10 +64,10 @@ end
local function inject_nobreak_space(unicode,head,current,space,spacestretch,spaceshrink)
local attr = current.attr
+ head, current = insert_node_after(head,current,new_penalty(10000))
head, current = insert_node_after(head,current,new_glue(space,spacestretch,spaceshrink))
current.attr = attr
set_attribute(current,a_character,unicode)
- head, current = insert_node_after(head,current,new_penalty(10000))
return head, current
end
@@ -144,8 +146,12 @@ function characters.handler(head)
while current do
local next = current.next
if current.id == glyph_code then
- local method = methods[current.char]
+ local char = current.char
+ local method = methods[char]
if method then
+ if trace_characters then
+ report_characters("replacing character U+%04X (%s)",char,lower(chardata[char].description))
+ end
head = method(head,current)
head = remove_node(head,current,true)
done = true