diff options
author | Karl Berry <karl@freefriends.org> | 2012-05-06 23:12:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-05-06 23:12:06 +0000 |
commit | ec4155a8b435806195767c2047ab6b3f9f2a1052 (patch) | |
tree | c7c5a7ca784c6239ddb222248150a53843427b63 /Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua | |
parent | 3c6cdccdf8a900337b27e6c4099aeea5dbc86dcb (diff) |
luatexja 20120506.0
git-svn-id: svn://tug.org/texlive/trunk@26229 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua index c21e2616219..6e1da777226 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua @@ -31,35 +31,56 @@ end -- \ucs: 単なる identity function from_ucs(i) + if type(i)~='number' then + ltjb.package_error('luatexja', + "invalid character code (".. tostring(i) .. ")", + "I'm going to use 0 instead of that illegal character code.") + i=0 + end tex.write(i) end --- \kuten: 面区点 (それぞれで16進2桁を使用)=> Unicode 符号位置 +-- \kuten: 面区点 (それぞれで16進2桁を使用)=> Unicharacter code 符号位置 function from_kuten(i) - if not i then i=0 end - tex.write(tostring(luatexja.jisx0208.table_jisx0208_uptex[i]) or '0') + if type(i)~='number' then + ltjb.package_error('luatexja', + "invalid character code (".. tostring(i) .. ")", + "I'm going to use 0 instead of that illegal character code.") + i=0 + end + tex.write(tostring(luatexja.jisx0208.table_jisx0208_uptex[i] or 0)) end --- \euc: EUC-JP による符号位置 => Unicode 符号位置 +-- \euc: EUC-JP による符号位置 => Unicharacter code 符号位置 function from_euc(i) - if not i then i=0 + if type(i)~='number' then + ltjb.package_error('luatexja', + "invalid character code (".. tostring(i) .. ")", + "I'm going to use 0 instead of that illegal character code.") + i=0 elseif i>=0x10000 or i<0xa0a0 then i=0 end from_kuten(i-0xa0a0) end --- \jis: ISO-2022-JP による符号位置 => Unicode 符号位置 +-- \jis: ISO-2022-JP による符号位置 => Unicharacter code 符号位置 function from_jis(i) - if (not i) or i>=0x10000 or i<0 then + if (type(i)~='number') or i>=0x10000 or i<0 then + ltjb.package_error('luatexja', + "invalid character code (".. tostring(i) .. ")", + "I'm going to use 0 instead of that illegal character code.") i=0 end from_kuten(i-0x2020) end --- \sjis: Shift_JIS による符号位置 => Unicode 符号位置 +-- \sjis: Shift_JIS による符号位置 => Unicharacter code 符号位置 function from_sjis(i) - if (not i) or i>=0x10000 or i<0 then + if (type(i)~='number') or i>=0x10000 or i<0 then + ltjb.package_error('luatexja', + "invalid character code (".. tostring(i) .. ")", + "I'm going to use 0 instead of that illegal character code.") tex.write('0'); return end local c2 = math.floor(i/256) |