summaryrefslogtreecommitdiff
path: root/tex/context/base/scrp-cjk.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-04-13 14:40:14 +0300
committerMarius <mariausol@gmail.com>2013-04-13 14:40:14 +0300
commit98134bfc67087dc07efc564af43b412aeaada533 (patch)
tree39c5cb8b299e2998257d46f28080e3f08dd7864a /tex/context/base/scrp-cjk.lua
parentf1d1810c094ecdb27626bfe4fc97a43a91675b2a (diff)
downloadcontext-98134bfc67087dc07efc564af43b412aeaada533.tar.gz
beta 2013.04.13 13:24
Diffstat (limited to 'tex/context/base/scrp-cjk.lua')
-rw-r--r--tex/context/base/scrp-cjk.lua32
1 files changed, 31 insertions, 1 deletions
diff --git a/tex/context/base/scrp-cjk.lua b/tex/context/base/scrp-cjk.lua
index 5885c9867..487d5a267 100644
--- a/tex/context/base/scrp-cjk.lua
+++ b/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