From ce06e747479580a31c323abba1ce2c4e7ce26c6f Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 18 Sep 2013 22:06:00 +0200 Subject: beta 2013.09.18 22:06 --- tex/context/base/context-version.pdf | Bin 4109 -> 4103 bytes tex/context/base/spac-chr.lua | 56 ++++++++++++++++++++++++++++------- tex/context/base/status-files.pdf | Bin 24755 -> 24754 bytes 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index ceeaf90a4..b7288b53d 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/spac-chr.lua b/tex/context/base/spac-chr.lua index 03c60d275..d59725edf 100644 --- a/tex/context/base/spac-chr.lua +++ b/tex/context/base/spac-chr.lua @@ -26,9 +26,9 @@ local insert_node_after = node.insert_after local remove_node = nodes.remove -- ! nodes local copy_node_list = node.copy_list -local nodepool = nodes.pool local tasks = nodes.tasks +local nodepool = nodes.pool local new_penalty = nodepool.penalty local new_glue = nodepool.glue @@ -43,6 +43,8 @@ local chardata = characters.data local typesetters = typesetters +local unicodeblocks = characters.blocks + local characters = typesetters.characters or { } -- can be predefined typesetters.characters = characters @@ -51,6 +53,8 @@ local fontparameters = fonthashes.parameters local fontcharacters = fonthashes.characters local fontquads = fonthashes.quads +local setmetatableindex = table.setmetatableindex + local a_character = attributes.private("characters") local a_alignstate = attributes.private("alignstate") @@ -95,13 +99,6 @@ local function inject_nobreak_space(unicode,head,current,space,spacestretch,spac return head, current end -local keepnbspbefore = { - [0x094D] = true, -- category mn - [0x0CCD] = true, -} - -characters.keepnbspbefore = keepnbspbefore -- so we can extend - local function nbsp(head,current) local para = fontparameters[current.font] if current[a_alignstate] == 1 then -- flushright @@ -129,18 +126,55 @@ function characters.replacenbspaces(head,nbspaces) return head end +-- This initialization might move someplace else if we need more of it. The problem is that +-- this module depends on fonts so we have an order problem. + +local nbsphash = { } setmetatableindex(nbsphash,function(t,k) + for i=unicodeblocks.devanagari.first,unicodeblocks.devanagari.last do nbsphash[i] = true end + for i=unicodeblocks.kannada .first,unicodeblocks.kannada .last do nbsphash[i] = true end + setmetatableindex(nbsphash,nil) + return nbsphash[k] +end) + local methods = { -- The next one uses an attribute assigned to the character but still we -- don't have the 'local' value. + -- [0x00A0] = function(head,current) -- nbsp + -- local next = current.next + -- if next and next.id == glyph_code then + -- local char = next.char + -- if char >= 0x00900 and char <= 0x0097F then + -- return false -- devangari + -- end + -- if char >= 0x00C80 and char <= 0x00CFF then + -- return false -- kannada + -- end + -- end + -- local prev = current.prev + -- if prev and prev.id == glyph_code then + -- local char = prev.char + -- if char >= 0x00900 and char <= 0x0097F then + -- return false -- devangari + -- end + -- if char >= 0x00C80 and char <= 0x00CFF then + -- return false -- kannada + -- end + -- end + -- return nbsp(head,current) + -- end, + [0x00A0] = function(head,current) -- nbsp local next = current.next - if next and next.id == glyph_code and keepnbspbefore[next.char] then + if next and next.id == glyph_code and nbsphash[next.char] then return false - else - return nbsp(head,current) end + local prev = current.prev + if prev and prev.id == glyph_code and nbsphash[prev.char] then + return false -- kannada + end + return nbsp(head,current) end, [0x2000] = function(head,current) -- enquad diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index a81b02912..0555d1048 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ -- cgit v1.2.3