• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: Commit

ソースコードの管理場所


Commit MetaInfo

Revisionc2d8b32b20504d489c21ff2e877dc19262be49bb (tree)
Time2022-05-22 14:43:09
AuthorHironori Kitagawa <h_kitagawa2001@yaho...>
CommiterHironori Kitagawa

Log Message

Fix #44426

Change Summary

Incremental Difference

--- a/src/patches/lltjp-listings.sty
+++ b/src/patches/lltjp-listings.sty
@@ -1,10 +1,11 @@
11 %
2-% lltjp-listings.sty 2020-03-23
2+% lltjp-listings.sty 2022-05-22
33 %
44
55 \NeedsTeXFormat{LaTeX2e}
66 \RequirePackage{etoolbox,listings,luatexbase-cctb}
77
8+\newcount\ltj@lst@japanese@min \ltj@lst@japanese@min=128
89 %%%%%%%%%%%%%%%% Japanese support
910 %% whether letter-space in a fixed mode box is doubled or not
1011 \newif\if@ltj@lst@double
@@ -197,9 +198,6 @@
197198 \lsthk@PreSet\lstset{flexiblecolumns,#1}%
198199 \lsthk@TextStyle
199200 \@ifnextchar\bgroup \ltj@lst@InlineG \ltj@lstinline@}
200-\def\ltj@lstinline@#1{%
201- \edef\ltj@lst@temp{\the\catcode`#1}\lst@Init\relax\catcode`#1\ltj@lst@temp
202- \lst@InlineJ#1}
203201 \def\ltj@lst@InlineG{%
204202 \lst@Init\relax\edef\ltj@lst@temp{\the\catcode`\}}\catcode`\}=2 \catcode`\ =12\relax
205203 \let\lst@arg\@empty\afterassignment\ltj@lst@InlineG@@\@temptokena}
@@ -207,9 +205,16 @@
207205 \catcode`\}=\ltj@lst@temp%
208206 \expandafter\expandafter\expandafter\lst@InsideConvert%
209207 \expandafter{\the\@temptokena}\lst@arg\lst@DeInit\egroup}
210-
211-%%%%%%%%%%%%%%%% \lstMakeShortInline
212-\patchcmd\lstMakeShortInline@{\lst@shortinlinedef#1}{\lst@shortinlinedef~}{}{}
208+\def\ltj@lstinline@#1{%
209+ \edef\ltj@lst@temp{\the\catcode`#1}
210+ \lst@Init\relax\catcode`#1\ltj@lst@temp
211+ \ifnum\ltj@lst@temp=\active
212+ \begingroup\lccode`\~=`#1\relax
213+ \lowercase{\xdef\lst@next{\noexpand\lst@InlineJ\noexpand~}}\endgroup%
214+ \else
215+ \edef\lst@next{\noexpand\lst@InlineJ\scantextokens{#1}}%
216+ \fi\lst@next
217+}
213218
214219 % We redefine \lst@BeginDropInput, since now we have
215220 % two additional `process macros'.
@@ -239,7 +244,7 @@
239244 for i = 1, utf.len(buf) do
240245 local c = utf.sub(buf, i, i)
241246 local cu = utf.byte(c)
242- if cu >= 0x80 and tex.getcatcode(cu) \string~= 13 then
247+ if cu >= \the\ltj@lst@japanese@min\space and tex.getcatcode(cu) \string~= 13 then
243248 ret = ret .. utfchar(getcount('ltjlineendcomment'))
244249 end
245250 ret = ret .. c
@@ -283,7 +288,7 @@
283288 \gdef\ltj@lst@MakeActive@#1{\let\lst@next\relax%
284289 \ifx#1\relax
285290 \else\let\lst@next\ltj@lst@MakeActive@
286- \ifnum`#1>127
291+ \ifnum`#1>\numexpr\ltj@lst@japanese@min-1
287292 \lccode`\^^A=`#1
288293 \lowercase{\lst@lAddTo\lst@temp{$^^A}}%$
289294 \else
Binary files a/test/test13-listings.pdf and b/test/test13-listings.pdf differ
--- a/test/test13-listings.tex
+++ b/test/test13-listings.tex
@@ -1,8 +1,9 @@
11 %#!lualatex
22 \documentclass{article}
33
4-\usepackage{luatexja-fontspec,amsmath}
54 \usepackage{listings,color,showexpl,comment}
5+\lstMakeShortInline÷
6+\usepackage{luatexja-fontspec,amsmath}
67 \usepackage{luatexja-otf}\directlua{luatexja.otf.enable_ivs()}
78 \usepackage
89 [
@@ -33,7 +34,7 @@
3334 \fi
3435 }{}
3536 \DeclareKanjiFamily{JY3}{koz}{}
36-\DeclareFontShape{JY3}{koz}{m}{n}{<-> s * [1.2] HaranoAjiMincho-Regular:jfm=ujis}{}
37+\DeclareFontShape{JY3}{koz}{m}{n}{<-> s * [1.2] KozMinPr6N-Regular:jfm=ujis}{}
3738 \DeclareFontShape{JY3}{koz}{m}{sl}{<-> s * [1.2] psft:Ryumin-Light:jfm=ujis;slant=0.167}{}
3839 \DeclareFontShape{JY3}{koz}{m}{it}{<-> ssub* koz/m/sl}{}
3940 \def\mcdefault{koz}
@@ -186,13 +187,17 @@ IVS対応2: \texttt{vsraw=true}
186187
187188 foo \lstinline[basicstyle=\tt]!ba{}#shr! baz あ
188189
189-あ\lstinline[basicstyle=\tt]{bar s}hoge
190+1あ\lstinline[basicstyle=\tt]{bar s}hoge
191+
192+2あ\lstinline[basicstyle=\tt]{bar..{a}hoge
190193
191-あ\lstinline[basicstyle=\tt]{bar..{a}hoge
194+foo \lstinline[basicstyle=\tt\gtfamily]!exit 0; #shbar! baz あ
192195
193-foo \lstinline[basicstyle=\tt\gtfamily]!あexit 0; #shbar! baz あ
196+foo \lstinline[basicstyle=\tt\gtfamily]!あreturn 0; #shbar! baz あ
194197
195-あ\lstinline[basicstyle=\tt]{いbexit #sh$ar}hoge
198+3あ\lstinline[basicstyle=\tt]{fexit #sh$ar}hoge
199+
200+4あ\lstinline[basicstyle=\tt]{いbexit #sh$ar}hoge
196201
197202 \bigskip
198203 \textbf{Ticket \#35484}
@@ -201,8 +206,8 @@ foo \lstinline[basicstyle=\tt\gtfamily]!あexit 0; #shbar! baz あ
201206 \colorbox{red}{\lstinline!あいexit 0;#shうえお!}
202207
203208
204-\colorbox{red}{\lstinline{aiu#sheoxyz}}
205-\colorbox{red}{\lstinline{あいexit 0;#shうえお}}
209+\colorbox{red}{\lstinline{aGiu#sheoxyz}}
210+\colorbox{red}{\lstinline{あGいexit 0;#shうえお}}
206211
207212 あおいうえお
208213 \begin{lstlisting}[frame=single]
@@ -216,29 +221,15 @@ aiu
216221 1234567890123457890
217222 aiu# \textcolor{red}{e} #o#\textcolor{red}{ka}#ki
218223 \end{lstlisting}
224+\typeout{AAAA}
219225
220-
221-\newpage
222-\lstset{basewidth=0.75\zw,basicstyle=\ttfamily,doubleletterspace,backgroundcolor=}
223-\noindent
224-\def\A{\leavevmode\smash{\hbox to 0.75\zw{\kern-.0625mm\vrule height 0pt depth 200pt width 0.125mm\hss}}}%
225-\textcolor{cyan}{\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A\A}%
226-
227-\begin{lstlisting}
228-a.b.c.d.e.f.g.h.i.j.k.l.m.
229-123(あいう@(カンジabc
230-a.b.c.d.e.f.g.h.i.j.k.l.m.
231-123あいう)@(カンジabc
232-a.b.c.d.e.f.g.h.i.j.k.l.m.
233-123あい:う@(カンジabc
234-\end{lstlisting}
235-
236-\begin{lstlisting}[columns={[l]flexible}]
237-a.b.c.d.e.f.g.h.i.j.k.l.m.
238-123(あいう@(カンジabc
239-a.b.c.d.e.f.g.h.i.j.k.l.m.
240-123あいう)@(カンジabc
241-a.b.c.d.e.f.g.h.i.j.k.l.m.
242-123あい:う@(カンジabc
243-\end{lstlisting}
226+\bigskip
227+\textbf{Ticket \#44426}\lstset{basicstyle=\itshape}
228+Foo ÷fo#shbarあ{#}o÷ Foo
229+\colorbox{green}{÷fo#shbarあ{#}o÷}
230+
231+\lstMakeShortInline あ
232+÷いfo#shbarあ{#}}o÷
233+あえbazあ
234+あbaxあ
244235 \end{document}
Show on old repository browser