summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-12-14 17:21:42 +0000
committerKarl Berry <karl@freefriends.org>2015-12-14 17:21:42 +0000
commit7e7b3ad9875434c71de5f91338327a5c82193d1d (patch)
tree6242dca91601ddad0f0bd98f5e3932ab0aeb8ea2 /Master/texmf-dist
parent7039986c5ad79fac13b8b725dfee4001f7f85332 (diff)
luatexja (12dec15)
git-svn-id: svn://tug.org/texlive/trunk@39105 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/luatex/luatexja/README8
-rw-r--r--Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdfbin435351 -> 431785 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdfbin776008 -> 773088 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx85
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty2
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty2
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua11
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua5
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty38
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty145
10 files changed, 186 insertions, 110 deletions
diff --git a/Master/texmf-dist/doc/luatex/luatexja/README b/Master/texmf-dist/doc/luatex/luatexja/README
index 88c48332967..a75665e7145 100644
--- a/Master/texmf-dist/doc/luatex/luatexja/README
+++ b/Master/texmf-dist/doc/luatex/luatexja/README
@@ -1,4 +1,4 @@
-The LuaTeX-ja Package 20151103.0
+The LuaTeX-ja Package 20151212.0
--------------------------------
Copyright (c) 2011--2015 The LuaTeX-ja project
License: modified BSD (see COPYING)
@@ -34,9 +34,9 @@ Installation
2. If you must/want to install manually:
a. Download the source archive from CTAN,
- or tagged as 20151103.0 in the Git repository by
+ or tagged as 20151212.0 in the Git repository by
<http://git.osdn.jp/view?p=luatex-ja/luatexja.git
- ;a=snapshot;h=refs/tags/20151103.0;sf=tgz>
+ ;a=snapshot;h=refs/tags/20151212.0;sf=tgz>
b. Extract the archive and process following three files by LuaLaTeX
to generate classes for Japanese typesetting:
@@ -81,4 +81,4 @@ Notes
* src/*.{ins.dtx} and src/ltj-kinsoku_make.tex are not needed in regular use.
-Last commit date: Tue Nov 3 19:36:02 2015 +0900
+Last commit date: Sat Dec 12 13:51:34 2015 +0900
diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
index 76e96e89cd7..94a99e28947 100644
--- a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
+++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
index ab9b3f19b51..5d7ac92097b 100644
--- a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
+++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx
index 6ac495c4a4e..ab334e5c7a2 100644
--- a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx
+++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx
@@ -24,16 +24,17 @@
%%%%%%%% fonts
\usepackage{luatexja-otf}
\directlua{luatexja.otf.enable_ivs()}
-\usepackage[match,no-math]{luatexja-fontspec}
-\usepackage[kozuka-pr6n]{luatexja-preset}
-\usepackage{unicode-math}
+\usepackage[no-math]{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmonofont[Scale=MatchLowercase, ItalicFont=lmmono10-italic.otf,
BoldFont=lmmonolt10-bold.otf, BoldItalicFont=lmmonolt10-boldoblique.otf
]{lmmono10-regular.otf}
+\setsansfont[Scale=MatchLowercase,Ligatures=TeX]{Linux Biolinum O}
+\usepackage[match]{luatexja-fontspec}
+\usepackage[kozuka-pr6n]{luatexja-preset}
+\usepackage{unicode-math}
\setmonojfont{KozGoPr6N-Regular.otf}
\setmathfont[Scale=MatchLowercase]{xits-math.otf}
-\setsansfont[Scale=MatchLowercase,Ligatures=TeX]{Linux Biolinum O}
\setLaTeXa{\scshape a}
%<*ja>
@@ -8857,45 +8858,45 @@ then the patch \Pkg{lltjp-listings} is loaded automatically at \verb+\begin{docu
%<en>\subsection{Notes and additional keys}
%<ja>\subsection{注意}
-%<*en>
-\paragraph{Escaping to \LaTeX}
-We used the \verb+process_input_buffer+ callback to output \textbf{JAchar}s.
-But it has a drawback; any commands whose name contains a \textbf{JAchar}
-cannot be used in any ``escape to \LaTeX''.
+% %<*en>
+% \paragraph{Escaping to \LaTeX}
+% We used the \verb+process_input_buffer+ callback to output \textbf{JAchar}s.
+% But it has a drawback; any commands whose name contains a \textbf{JAchar}
+% cannot be used in any ``escape to \LaTeX''.
-Consider the following input:
-%</en>
-%<*ja>
-\paragraph{\LaTeX へのエスケープ}
-日本語対応を行うために \verb+process_input_buffer+ を使用したことで,
-\texttt{texcl},~\texttt{escapeinside}といった\emph{「\LaTeX へのエスケープ」中では,
-\textbf{JAchar}を名称の一部に含む制御綴は使用不可能}である.
-例えば次のような入力を考えよう:
-%</ja>
-\begin{verbatim*}
-\begin{lstlisting}[escapechar=\#]
-#\ほげ xぴよ#
-\end{lstlisting}
-\end{verbatim*}
-%<en>The line~2 is transformed by the callback to
-%<ja>ここで,2行目は \verb+process_input_buffer+ の作用により,
-\begin{lstlisting}[showspaces, escapechar=\!]
-#\!\IVSA FFFFF!ほ!\IVSA FFFFF!げ x!\IVSA FFFFF!ぴ!\IVSA FFFFF!よ#
-\end{lstlisting}
-%<*en>
-before the line is actually processed.
-In the escape (between the character ``\verb+#+''),
-the category code of \texttt{U+FFFFF} is set to 9~(\emph{ignored}).
-Hence the control symbol ``\cs{}\IVSA FFFFF'' will be executed,
-instead of ``\verb+\ほげ+''.
-%</en>
-%<*ja>
-と変換されてから,実際の処理に回される.
-「\verb+#+」で挟まれた「\LaTeX へのエスケープ」中では\
-\texttt{U+FFFFF} のカテゴリーコードは9~(\textit{ignored})となるので,
-結局「\verb+\ほげ+」の代わりに
-「\cs{}\IVSA FFFFF」というcontrol symbolが実行されることになる.
-%</ja>
+% Consider the following input:
+% %</en>
+% %<*ja>
+% \paragraph{\LaTeX へのエスケープ}
+% 日本語対応を行うために \verb+process_input_buffer+ を使用したことで,
+% \texttt{texcl},~\texttt{escapeinside}といった\emph{「\LaTeX へのエスケープ」中では,
+% \textbf{JAchar}を名称の一部に含む制御綴は使用不可能}である.
+% 例えば次のような入力を考えよう:
+% %</ja>
+% \begin{verbatim*}
+% \begin{lstlisting}[escapechar=\#]
+% #\ほげ xぴよ#
+% \end{lstlisting}
+% \end{verbatim*}
+% %<en>The line~2 is transformed by the callback to
+% %<ja>ここで,2行目は \verb+process_input_buffer+ の作用により,
+% \begin{lstlisting}[showspaces, escapechar=\!]
+% #\!\IVSA FFFFF!ほ!\IVSA FFFFF!げ x!\IVSA FFFFF!ぴ!\IVSA FFFFF!よ#
+% \end{lstlisting}
+% %<*en>
+% before the line is actually processed.
+% In the escape (between the character ``\verb+#+''),
+% the category code of \texttt{U+FFFFF} is set to 9~(\emph{ignored}).
+% Hence the control symbol ``\cs{}\IVSA FFFFF'' will be executed,
+% instead of ``\verb+\ほげ+''.
+% %</en>
+% %<*ja>
+% と変換されてから,実際の処理に回される.
+% 「\verb+#+」で挟まれた「\LaTeX へのエスケープ」中では\
+% \texttt{U+FFFFF} のカテゴリーコードは9~(\textit{ignored})となるので,
+% 結局「\verb+\ほげ+」の代わりに
+% 「\cs{}\IVSA FFFFF」というcontrol symbolが実行されることになる.
+% %</ja>
%<*en>
\paragraph{Variation selectors}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
index 9a8ee54c350..917ba786a5b 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
@@ -324,7 +324,7 @@
} {}
\DeclareFontShape{JT3}{#1}{#2}{n}{ <-> s*[\fp_use:N \l_ltjpreset_scale_fp]
{\bool_if:NT \l_ltjpreset_noembed_bool {psft:} "#3"
- : jfm=ujisv ;-kern;\tl_use:N \l_ltjpreset_kanji_shape_tl
+ : jfm=ujisv ;-kern;\tl_use:N \l_ltjpreset_kanji_shape_tl;
; script=latn \bool_if:NT \l_ltjpreset_expert_bool { ;+vkna }}
} {}
\bool_if:NT \l_ltjpreset_expert_bool {
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
index b40ec97800b..f3ad648817c 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
@@ -8,7 +8,7 @@
\RequirePackage{luatexja}
%%------------------
-\newluatexattribute\ltj@rubyattr
+\newattribute\ltj@rubyattr
\ltj@rubyattr=0
\RequireLuaTeXjaSubmodule{ruby}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
index 7c5ba8661aa..af80272ea6c 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
@@ -358,7 +358,11 @@ local function calc_np_aux_glyph_common(lp)
if ls==2 then -- アクセント用の kern
set_attr(lx, attr_icflag, PROCESSED)
lx = node_next(lx) -- lx: アクセント本体
- setfield(lx, 'yoffset', getfield(lx, 'yoffset') - (has_attr(lx,attr_ablshift) or 0))
+ if getid(lx)==id_glyph then
+ setfield(lx, 'yoffset', getfield(lx, 'yoffset') - (has_attr(lx,attr_ablshift) or 0))
+ else -- アクセントは上下にシフトされている
+ setfield(lx, 'shift', getfield(lx, 'shift') + (has_attr(lx,attr_ablshift) or 0))
+ end
lx = node_next(node_next(lx))
elseif ls==0 then
Np.last = lx
@@ -494,6 +498,11 @@ local calc_np_auxtable = {
if getsubtype(lp)==2 then
Np.first = Np.first or lp
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
+ if getid(lp)==id_glyph then -- アクセント本体
+ setfield(lp, 'yoffset', getfield(lp, 'yoffset') - (has_attr(lp,attr_ablshift) or 0))
+ else -- アクセントは上下にシフトされている
+ setfield(lp, 'shift', getfield(lp, 'shift') + (has_attr(lp,attr_ablshift) or 0))
+ end
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
set_attr(lp, attr_icflag, PROCESSED);
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
index 3e4e0b1522c..cfd544c0fe3 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua
@@ -325,6 +325,8 @@ do
-- extract jfm_file_name and jfm_var
-- normalize position of 'jfm=' and 'jfmvar=' keys
local function extract_metric(name)
+ local is_braced = name:match('^{(.*)}$')
+ name= is_braced or name
jfm_file_name = ''; jfm_var = ''; jfm_ksp = true
local tmp, index = name:sub(1, 5), 1
if tmp == 'file:' or tmp == 'name:' or tmp == 'psft:' then
@@ -374,7 +376,7 @@ do
else
is_vert_enabled = nil
end
- return name
+ return is_braced and ('{' .. name .. '}') or name
end
-- define_font callback
@@ -383,6 +385,7 @@ do
function luatexja.font_callback(name, size, id)
local new_name = is_def_jfont and extract_metric(name) or name
is_def_jfont = false
+ --local res = otfl_fdr(new_name, size, id)
local res = ltjr_font_callback(new_name, size, id, otfl_fdr)
luatexbase.call_callback('luatexja.define_font', res, new_name, size, id)
-- this callback processes variation selector, so we execute it always
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
index dc51b7a3a39..bf39e7890b4 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
@@ -65,7 +65,7 @@
\expandafter\let\csname ifltj@in@latex\expandafter\endcsname
\csname iftrue\endcsname
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{luatexja-core}[2015/11/03 Core of LuaTeX-ja]
+ \ProvidesPackage{luatexja-core}[2015/12/11 Core of LuaTeX-ja]
\fi %</LaTeX>
%% Load prerequisite packages.
@@ -73,6 +73,7 @@
\newif\ifltj@everyhook@avail\ltj@everyhook@availfalse
%! 外部パッケージは普通の \endlinechar で読まないと危険.
\ifltj@in@latex %<*LaTeX>
+ \RequirePackage{luatexbase}
\RequirePackage{luaotfload} [2013/12/31] % v2.3
\RequirePackage{ltxcmds} [2011/11/09] % v1.22
\RequirePackage{pdftexcmds} [2011/11/29] % v0.20
@@ -80,6 +81,7 @@
\RequirePackage{atbegshi}
\IfFileExists{everyhook.sty}{\RequirePackage{everyhook}\ltj@everyhook@availtrue}{}
\else %<*!LaTeX>
+ \input luatexbase.sty
\input luaotfload.sty
\input ltxcmds.sty
\input pdftexcmds.sty
@@ -132,21 +134,21 @@
\def\ltj@defdimen{0}
%%%%%%%% Attributes for Japanese typesetting.
-\newluatexattribute\ltj@icflag % attribute for italic correction
-\newluatexattribute\ltj@curjfnt % index for ``current horizontal Japanese font''
-\newluatexattribute\ltj@curtfnt % index for ``current vertical Japanese font''
-\newluatexattribute\ltj@origchar %
-\newluatexattribute\ltj@charclass %
-\newluatexattribute\ltj@charcode %
-\newluatexattribute\ltj@autospc % attribute for autospacing
-\newluatexattribute\ltj@autoxspc % attribute for autoxspacing
-\newluatexattribute\ltj@yablshift % attribute for yalbaselineshift
-\newluatexattribute\ltj@ykblshift % attribute for yjabaselineshift
-\newluatexattribute\ltj@tablshift % attribute for talbaselineshift
-\newluatexattribute\ltj@tkblshift % attribute for tjabaselineshift
-\newluatexattribute\jfam % index for current jfam
-
-\newluatexattribute\ltj@dir
+\newattribute\ltj@icflag % attribute for italic correction
+\newattribute\ltj@curjfnt % index for ``current horizontal Japanese font''
+\newattribute\ltj@curtfnt % index for ``current vertical Japanese font''
+\newattribute\ltj@origchar %
+\newattribute\ltj@charclass %
+\newattribute\ltj@charcode %
+\newattribute\ltj@autospc % attribute for autospacing
+\newattribute\ltj@autoxspc % attribute for autoxspacing
+\newattribute\ltj@yablshift % attribute for yalbaselineshift
+\newattribute\ltj@ykblshift % attribute for yjabaselineshift
+\newattribute\ltj@tablshift % attribute for talbaselineshift
+\newattribute\ltj@tkblshift % attribute for tjabaselineshift
+\newattribute\jfam % index for current jfam
+
+\newattribute\ltj@dir
\newlanguage\ltj@@japanese
\ltj@dir\z@
\ltj@icflag\z@
@@ -159,7 +161,7 @@
\newcount\ltj@tempcnta
\ltj@tempcnta\z@
\loop\ifnum\ltj@tempcnta<7
- \expandafter\newluatexattribute%
+ \expandafter\newattribute%
\csname ltj@kcat\the\ltj@tempcnta\endcsname
\csname ltj@kcat\the\ltj@tempcnta\endcsname=0
\advance\ltj@tempcnta\@ne
@@ -765,7 +767,7 @@
\input ltj-plain.sty %
\fi\fi %</LaTeX|plain>
-\newluatexcatcodetable\ltj@temp@cctb
+\newcatcodetable\ltj@temp@cctb
\def\ltj@overwrite@catcodetable#1{%
\setluatexcatcodetable\ltj@temp@cctb{\luatexcatcodetable#1}%
\setluatexcatcodetable#1{\luatexcatcodetable\ltj@temp@cctb\catcode"FFFFF=14}%"
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty
index dfd97ca054d..40c71c83a7b 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty
@@ -3,7 +3,7 @@
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-listings}[2015/09/10 Patch to listings for LuaTeX-ja]
+\ProvidesPackage{lltjp-listings}[2015/12/11 Patch to listings for LuaTeX-ja]
\RequirePackage{listings,luatexbase-cctb}
%%%%%%%%%%%%%%%% Japanese support
@@ -35,8 +35,8 @@
local cat_lp = luatexbase.catcodetables['latex-package']
local ubyte = unicode.utf8.byte
local spccmd = string.char(0x5C) .. 'ltj@lst@hss@normal'
- luatexja.lst = {}
- function luatexja.lst.althss(t)
+ luatexja.listings = {}
+ function luatexja.listings.althss(t)
t = ubyte(t)
if not (t>=0xE0100 and t<0xE01F0) then
tex.sprint(cat_lp, spccmd)
@@ -44,7 +44,7 @@
end
}
\def\ltj@lst@hss@ivs#1{%
- \directlua{luatexja.lst.althss('\luatexluaescapestring{#1}')}#1%
+ \directlua{luatexja.listings.althss('\luatexluaescapestring{#1}')}#1%
}
\def\ltj@lst@hss@double{\lst@hss\lst@hss}
@@ -179,25 +179,23 @@
\SetCatcodeRange{"FE00}{"FE0F}{13}% Variation Selector
}
-% redefine \lstinline@ and \lst@InlineG
-% because \lstinline!あ...! causes ``Runaway argument?'' Error
-\def\lstinline@#1{%
- \lst@Init\relax
- \ltj@lst@check@inline{\lst@InlineM#1}{\lst@InlineJ#1}}
-\def\lst@InlineG{%
- \lst@Init\relax
- \ltj@lst@check@inline{\lst@InlineM\}}%
- {\let\lst@arg\@empty \lst@InlineGJ}}
-
-\def\ltj@lst@check@inline#1#2#3{%
- \begingroup \lccode`\~=`#3\lowercase{\endgroup
- \ifx~}#3%
- \def\lst@next{#1}%
- \else\ifnum`#3>127\relax
- \def\lst@next{#1}%
- \else
- \def\lst@next{#2}%
- \fi\fi\lst@next #3}
+% redefine \lstinline and its inner commands to support Japanese characters
+\renewcommand\lstinline[1][]{%
+ \leavevmode\bgroup % \hbox\bgroup --> \bgroup
+ \def\lst@boxpos{b}%
+ \lsthk@PreSet\lstset{flexiblecolumns,#1}%
+ \lsthk@TextStyle
+ \@ifnextchar\bgroup \ltj@lst@InlineG \ltj@lstinline@}
+\def\ltj@lstinline@#1{%
+ \edef\ltj@lst@temp{\the\catcode`#1}\lst@Init\relax\catcode`#1\ltj@lst@temp
+ \lst@InlineJ#1}
+\def\ltj@lst@InlineG{%
+ \lst@Init\relax\edef\ltj@lst@temp{\the\catcode`\}}\catcode`\}=2 \catcode`\ =12\relax
+ \let\lst@arg\@empty\afterassignment\ltj@lst@InlineG@@\@temptokena}
+\def\ltj@lst@InlineG@@{%
+ \catcode`\}=\ltj@lst@temp%
+ \expandafter\expandafter\expandafter\lst@InsideConvert%
+ \expandafter{\the\@temptokena}\lst@arg\lst@DeInit\egroup}
% We redefine \lst@BeginDropInput, since now we have
% two additional `process macros'.
@@ -216,24 +214,38 @@
\let\ltj@lst@ProcessJALetterHalf\@gobble % added
}}
+\directlua{
+ luatexja.listings.insert_cb = function()
+ if not luatexja.listings.patched then
+ luatexja.listings.patched = 1
+ luatexbase.add_to_callback('process_input_buffer',
+ function(buf)
+ local ret = ''
+ for i = 1, utf.len(buf) do
+ 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
+ end
+ ret = ret .. c
+ end
+ return ret
+ end, 'ltj.listings_unicode', 1)
+ end
+ end
+ luatexja.listings.remove_cb = function()
+ if luatexja.listings.patched then
+ luatexja.listings.patched = nil
+ luatexbase.remove_from_callback('process_input_buffer',
+ 'ltj.listings_unicode')%
+ end
+ end}
% hook!
\lst@AddToHook{Init}{%
\luatexcatcodetable\CatcodeTableLTJlistings\ltj@@listing@jpcmd
\lccode`\~="FFFFF\lowercase{\def~{\ltj@lst@ProcessJALetter}}%"
- \directlua{luatexbase.add_to_callback('process_input_buffer',
- function(buf)
- local ret = ''
- for i = 1, utf.len(buf) do
- 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
- end
- ret = ret .. c
- end
- return ret
- end, 'ltj.listings_unicode', 1)}%
+ \directlua{luatexja.listings.insert_cb()}%
\if@ltj@lst@double
\let\ltj@lst@hss@normal=\ltj@lst@hss@double
\else
@@ -245,12 +257,42 @@
\let\ltj@lst@hss=\ltj@lst@hss@normal
\fi
}
+
+\def\ltj@lst@MakeActive#1{%
+ \let\lst@temp\@empty \ltj@lst@MakeActive@#1\relax}
+\begingroup
+\catcode`\^^A=12
+\catcode`\^^@=\active
+\lccode`\$="FFFFF \catcode`\$=13 %"
+\lowercase{%
+\gdef\ltj@lst@MakeActive@#1{\let\lst@next\relax%
+ \ifx#1\relax
+ \else\let\lst@next\ltj@lst@MakeActive@
+ \ifnum`#1>127
+ \lccode`\^^A=`#1
+ \lowercase{\lst@lAddTo\lst@temp{$^^A}}%
+ \else
+ \lccode`\^^@=`#1
+ \lowercase{\lst@lAddTo\lst@temp{^^@}}%
+ \fi\fi\lst@next}}
+\endgroup
+
+
+\begingroup \lccode`\~=`\ \relax \lowercase{%
+\gdef\lst@InsideConvert@#1 #2{%
+ \ltj@lst@MakeActive{#1}%
+ \ifx\@empty#2%
+ \lst@lExtend\lst@arg{\lst@temp}%
+ \else
+ \lst@lExtend\lst@arg{\lst@temp~}%
+ \expandafter\lst@InsideConvert@
+ \fi #2}
+}\endgroup
+
\lst@AddToHook{ExitVars}{%
- \directlua{luatexbase.remove_from_callback('process_input_buffer',
- 'ltj.listings_unicode')}%
+ \directlua{luatexja.listings.remove_cb()}%
}
-
% 白線対策
\newif\ifltj@lst@frame@top
\newdimen\ltj@lst@frame@lslimit
@@ -302,7 +344,7 @@
%%%%%%%%%%%%%%%% escape to \LaTeX
\lstloadaspects{escape}
-\gdef\lst@Escape#1#2#3#4{%
+\gdef\lst@Escape#1#2#3#4{
\lst@CArgX #1\relax\lst@CDefX
{}%
{\lst@ifdropinput\else
@@ -320,10 +362,29 @@
{\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes
\lst@newlines\z@ \lst@whitespacefalse}%
{}%
- \fi
- #3\catcode"FFFFF=9\lst@escapebegin%"
+ \fi%
+ \ltj@lst@escape@setup#2%
+ #3\catcode"FFFFF=9\lst@escapebegin\expandafter\lst@next%"
\fi}%
{}}
+\def\ltj@lst@escape@setup#1{%
+ \begingroup\lccode`\~=`#1\lowercase{%
+ \gdef\lst@next##1~{%
+ \let\lst@arg\@empty\ltj@lst@remove@jacmd{##1}%
+ \expandafter\expandafter\expandafter\scantokens\expandafter{\lst@arg}%
+ ~}%
+ }\endgroup
+}
+\begingroup
+ \lccode`\|="FFFFF \lowercase{%"
+ \gdef\ltj@lst@remove@jacmd#1{%
+ \expandafter\ltj@lst@remove@jacmd@\detokenize{#1}|\@nil|}
+ \gdef\ltj@lst@remove@jacmd@#1|{%
+ \ifx#1\@nil\else
+ \lst@lAddTo\lst@arg{#1}%
+ \expandafter\ltj@lst@remove@jacmd@
+ \fi}}
+\endgroup
%%%%%%%%%%%%%%%%
\lstloadaspects{writefile}