From 54ab62738d5b9d46018ab9e96e3cd801ef6a7de9 Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Wed, 2 Mar 2016 20:44:31 +0900 Subject: [PATCH] "FFFFF -> \ltjlineendcomment --- src/ltj-inputbuf.lua | 10 +++++----- src/luatexja-core.sty | 8 +++++--- src/luatexja.sty | 2 +- src/patches/lltjp-listings.sty | 15 ++++++++------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/ltj-inputbuf.lua b/src/ltj-inputbuf.lua index cec74cf..d039f7d 100644 --- a/src/ltj-inputbuf.lua +++ b/src/ltj-inputbuf.lua @@ -8,12 +8,12 @@ luatexja.load_module('charrange'); local ltjc = luatexja.charrange 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. @@ -33,12 +33,12 @@ local function add_comment(buffer) 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 diff --git a/src/luatexja-core.sty b/src/luatexja-core.sty index c881570..7475f30 100644 --- a/src/luatexja-core.sty +++ b/src/luatexja-core.sty @@ -65,7 +65,7 @@ \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 % %% Load prerequisite packages. @@ -120,7 +120,9 @@ %! ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ % LuaTeX-ja core TeX source -\catcode"FFFFF=14 %" +\newcount\ltjlineendcomment +\ltjlineendcomment="FFFFF +\catcode\ltjlineendcomment=14 %" \def\ltj@loaded{hoge} @@ -771,7 +773,7 @@ \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 diff --git a/src/luatexja.sty b/src/luatexja.sty index 4d23965..2e55d5c 100644 --- a/src/luatexja.sty +++ b/src/luatexja.sty @@ -34,7 +34,7 @@ \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 % \directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs diff --git a/src/patches/lltjp-listings.sty b/src/patches/lltjp-listings.sty index 987cd69..253bf5b 100644 --- a/src/patches/lltjp-listings.sty +++ b/src/patches/lltjp-listings.sty @@ -3,7 +3,7 @@ % \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 @@ -173,7 +173,7 @@ \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 @@ -215,6 +215,7 @@ }} \directlua{ + local utfchar, getcount = unicode.utf8.char, tex.getcount luatexja.listings.insert_cb = function() if not luatexja.listings.patched then luatexja.listings.patched = 1 @@ -225,7 +226,7 @@ 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 @@ -244,7 +245,7 @@ % 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 @@ -263,7 +264,7 @@ \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 @@ -364,7 +365,7 @@ {}% \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{% @@ -376,7 +377,7 @@ }\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|{% -- 2.11.0