require("unicode")
local utflen = unicode.utf8.len
local utfbyte = unicode.utf8.byte
+local utfchar = unicode.utf8.char
local node_new = node.new
local node_free = node.free
local id_glyph = node.id('glyph')
-local getcatcode = tex.getcatcode
+local getcatcode, getcount = tex.getcatcode, tex.getcount
local ltjc_is_japanese_char_curlist = ltjc.is_japanese_char_curlist
-local FFFFF = string.char(0xF3,0xBF,0xBF,0xBF)
--- the following function is modified from jafontspec.lua (by K. Maeda).
--- Instead of "%", we use U+FFFFF for suppressing spaces.
if c>=0x80 then
local ct = getcatcode(c)
local te = tex.endlinechar
- local ctl = (te ~= -1) and (getcatcode(te)==5) and (getcatcode(0xFFFFF)==14)
+ local ctl = (te ~= -1) and (getcatcode(te)==5) and (getcatcode(getcount('ltjlineendcomment')==14)
-- Is the catcode of endline character is 5 (end-of-line)?
- -- Is the catcode of U+FFFFF (new comment char) is 14 (comment)?
+ -- Is the catcode of \ltjlineendcomment (new comment char) is 14 (comment)?
if ((ct==11) or (ct==12)) and ctl then
if ltjc_is_japanese_char_curlist(c) then
- buffer = buffer .. FFFFF -- U+FFFFF
+ buffer = buffer .. utfchar(getcount('ltjlineendcomment'))
end
end
end
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja-core}[2015/12/11 Core of LuaTeX-ja]
+ \ProvidesPackage{luatexja-core}[2016/03/03 Core of LuaTeX-ja]
\fi %</LaTeX>
%% Load prerequisite packages.
%! ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
% LuaTeX-ja core TeX source
-\catcode"FFFFF=14 %"
+\newcount\ltjlineendcomment
+\ltjlineendcomment="FFFFF
+\catcode\ltjlineendcomment=14 %"
\def\ltj@loaded{hoge}
\newcatcodetable\ltj@temp@cctb
\def\ltj@overwrite@catcodetable#1{%
\setluatexcatcodetable\ltj@temp@cctb{\luatexcatcodetable#1}%
- \setluatexcatcodetable#1{\luatexcatcodetable\ltj@temp@cctb\catcode"FFFFF=14}%"
+ \setluatexcatcodetable#1{\luatexcatcodetable\ltj@temp@cctb\catcode\ltjlineendcomment=14}%"
}
\ltj@overwrite@catcodetable\CatcodeTableLaTeX
\ltj@overwrite@catcodetable\CatcodeTableLaTeXAtLetter
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja}[2015/11/03 Japanese Typesetting with Lua(La)TeX]
+ \ProvidesPackage{luatexja}[2015/11/03 Japanese Typesetting with Lua(La))TeX]
\fi %</LaTeX>
\directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-listings}[2016/02/07 Patch to listings for LuaTeX-ja]
+\ProvidesPackage{lltjp-listings}[2016/03/02 Patch to listings for LuaTeX-ja]
\RequirePackage{listings,luatexbase-cctb}
%%%%%%%%%%%%%%%% Japanese support
\newluatexcatcodetable\CatcodeTableLTJlistings
\setluatexcatcodetable\CatcodeTableLTJlistings{%
\luatexcatcodetable\CatcodeTableLaTeXAtLetter
- \catcode"FFFFF=13%"
+ \catcode\ltjlineendcomment=13%"
\SetCatcodeRange{"FF61}{"FF9F}{13}% 半角カナ
\SetCatcodeRange{"E0100}{"E01EF}{13}% 漢字用異体字セレクタ
\SetCatcodeRange{"FE00}{"FE0F}{13}% Variation Selector
}}
\directlua{
+ local utfchar, getcount = unicode.utf8.char, tex.getcount
luatexja.listings.insert_cb = function()
if not luatexja.listings.patched then
luatexja.listings.patched = 1
local c = utf.sub(buf, i, i)
local cu = utf.byte(c)
if cu >= 0x80 and tex.getcatcode(cu) \string~= 13 then
- ret = ret .. utf.char(1048575) % U+FFFFF
+ ret = ret .. utfchar(getcount('ltjlineendcomment'))
end
ret = ret .. c
end
% hook!
\lst@AddToHook{Init}{%
\luatexcatcodetable\CatcodeTableLTJlistings\ltj@@listing@jpcmd
- \lccode`\~="FFFFF\lowercase{\def~{\ltj@lst@ProcessJALetter}}%"
+ \lccode`\~=\ltjlineendcomment\lowercase{\def~{\ltj@lst@ProcessJALetter}}%"
\directlua{luatexja.listings.insert_cb()}%
\if@ltj@lst@double
\let\ltj@lst@hss@normal=\ltj@lst@hss@double
\begingroup
\catcode`\^^A=12
\catcode`\^^@=\active
-\lccode`\$="FFFFF \catcode`\$=13 %"
+\lccode`\$=\ltjlineendcomment \catcode`\$=13 %"
\lowercase{%
\gdef\ltj@lst@MakeActive@#1{\let\lst@next\relax%
\ifx#1\relax
{}%
\fi%
\ltj@lst@escape@setup#2%
- #3\catcode"FFFFF=9\lst@escapebegin\expandafter\lst@next%"
+ #3\catcode\ltjlineendcomment=9\lst@escapebegin\expandafter\lst@next%"
\fi}%
{}}
\def\ltj@lst@escape@setup#1{%
}\endgroup
}
\begingroup
- \lccode`\|="FFFFF \lowercase{%"
+ \lccode`\|=\ltjlineendcomment \lowercase{%"
\gdef\ltj@lst@remove@jacmd#1{%
\expandafter\ltj@lst@remove@jacmd@\detokenize{#1}|\@nil|}
\gdef\ltj@lst@remove@jacmd@#1|{%