summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/scrp-cjk.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/scrp-cjk.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/scrp-cjk.lua32
1 files changed, 31 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/context/base/scrp-cjk.lua b/Master/texmf-dist/tex/context/base/scrp-cjk.lua
index 5885c98671f..487d5a2672c 100644
--- a/Master/texmf-dist/tex/context/base/scrp-cjk.lua
+++ b/Master/texmf-dist/tex/context/base/scrp-cjk.lua
@@ -9,6 +9,11 @@ if not modules then modules = { } end modules ['scrp-cjk'] = {
-- We can speed this up by preallocating nodes and copying them but the
-- gain is not that large.
+-- The input line endings: there is no way to distinguish between
+-- inline spaces and endofline turned into spaces (would not make
+-- sense either because otherwise a wanted space at the end of a
+-- line would have to be a hard coded ones.
+
local utfchar = utf.char
local insert_node_after = node.insert_after
@@ -21,7 +26,10 @@ local new_kern = nodepool.kern
local new_penalty = nodepool.penalty
local nodecodes = nodes.nodecodes
+local skipcodes = nodes.skipcodes
local glyph_code = nodecodes.glyph
+local glue_code = nodecodes.glue
+local userskip_code = skipcodes.userskip
local a_prestat = attributes.private('prestat')
local a_preproc = attributes.private('preproc')
@@ -34,6 +42,7 @@ local numbertodataset = scripts.numbertodataset
local fonthashes = fonts.hashes
local fontdata = fonthashes.identifiers
local quaddata = fonthashes.quads
+local spacedata = fonthashes.spaces
local trace_details = false trackers.register("scripts.details", function(v) trace_details = v end)
@@ -96,6 +105,12 @@ local function trace_detail(current,what)
end
end
+local function trace_detail_between(p,n,what)
+ local p_ch = p.char
+ local n_ch = n.char
+ report_details("[%C %a] [%s] [%C %a]",p_ch,hash[p_ch],what,n_ch,hash[n_ch])
+end
+
local function nobreak(head,current)
if trace_details then
trace_detail(current,"break")
@@ -868,8 +883,13 @@ local function process(head,first,last)
end
end
previous = current
+
+-- elseif id == math_code then
+-- upcoming = end_of_math(current).next
+-- previous = "start"
+
else -- glue
- local p, n = first.prev, upcoming
+ local p, n = first.prev, upcoming -- we should remember prev
if p and n then
local pid, nid = p.id, n.id
if pid == glyph_code and nid == glyph_code then
@@ -882,7 +902,17 @@ local function process(head,first,last)
or pcjk == "half_width_close" or ncjk == "half_width_open" then -- extra compared to korean
previous = "start"
else -- if head ~= first then
+if id == glue_code and first.subtype == userskip_code then -- also prestat check?
+ -- for the moment no distinction possible between space and userskip
+ local w = first.spec.width
+ local s = spacedata[p.font]
+ if w == s then -- could be option
+ if trace_details then
+ trace_detail_between(p,n,"space removed")
+ end
remove_node(head,first,true)
+ end
+end
previous = pcjk
-- else
-- previous = pcjk