--
luatexbase.provides_module({
name = 'luatexja.charrange',
- date = '2014/05/08',
+ date = '2014/06/03',
description = 'Handling the range of Japanese characters',
})
module('luatexja.charrange', package.seeall)
luatexja.load_module('base'); local ltjb = luatexja.base
-local Dnode = node.direct or node
-local getchar = (Dnode ~= node) and Dnode.getchar or function(n) return n.char end
-local has_attr = Dnode.has_attribute
+local getchar = node.direct.getchar
+local has_attr = node.direct.has_attribute
local has_attr_node = node.has_attribute
local tex_getattr = tex.getattribute
local fn_table = {} -- used in is_ucs_in_japanese_char_direct
local nfn_table = {} -- used in is_ucs_in_japanese_char_node
for i = 0, 31*ATTR_RANGE-1 do
- local ka, pw = luatexbase.attributes['ltj@kcat'..floor(i/31)], pow(2, i%31)
+ local ka, pw = luatexbase.attributes['ltj@kcat'..floor(i/31)], 1/pow(2, i%31)
local jcr_noncjk = jcr_noncjk
- kcat_attr_table[i], pow_table[i] = ka, pw
- fn_table[i] = function(p) return floor(has_attr(p, ka)/pw)%2 ~= jcr_noncjk end
- nfn_table[i] = function(p) return floor(has_attr_node(p, ka)/pw)%2 ~= jcr_noncjk end
+ kcat_attr_table[i], pow_table[i] = ka, pow(2, i%31)
+ fn_table[i] = function(p) return floor(has_attr(p, ka)*pw)%2 ~= jcr_noncjk end
+ nfn_table[i] = function(p) return floor(has_attr_node(p, ka)*pw)%2 ~= jcr_noncjk end
end
fn_table[-1] = function() return false end -- for char --U+007F
nfn_table[-1] = function() return false end -- for char --U+007F