OSDN Git Service

Partial fix to ticket #35484
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Mon, 7 Sep 2015 23:07:34 +0000 (08:07 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Mon, 7 Sep 2015 23:07:34 +0000 (08:07 +0900)
src/patches/lltjp-listings.sty
test/test13-listings.pdf
test/test13-listings.tex

index f2fc58a..1edb37e 100644 (file)
@@ -3,7 +3,7 @@
 %
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-listings}[2015/01/08 Patch to listings for LuaTeX-ja]
+\ProvidesPackage{lltjp-listings}[2015/09/08 Patch to listings for LuaTeX-ja]
 \RequirePackage{listings,luatexbase-cctb}
 
 %%%%%%%%%%%%%%%% Japanese support
 
 
 % 白線対策
-\def\lst@OutputToken{%
-    \lst@TrackNewLines \lst@OutputLostSpace
-    \lst@ifgobbledws
-        \lst@gobbledwhitespacefalse
-        \lst@@discretionary
+\gdef\lst@frameInit{%
+    \ifx\lst@framelshape\@empty \let\lst@frameL\@empty \fi
+    \ifx\lst@framershape\@empty \let\lst@frameR\@empty \fi
+    \def\lst@framevrule{\vrule\@width\lst@framerulewidth\relax}%
+    \lst@ifframeround
+        \lst@frameCalcDimA\z@ \@getcirc\@tempdima
+        \@tempdimb\@tempdima \divide\@tempdimb\tw@
+        \advance\@tempdimb -\@wholewidth
+        \edef\lst@frametextsep{\the\@tempdimb}%
+        \edef\lst@framerulewidth{\the\@wholewidth}%
+        \lst@frameCalcDimA\@ne \@getcirc\@tempdima
+        \@tempdimb\@tempdima \divide\@tempdimb\tw@
+        \advance\@tempdimb -\tw@\@wholewidth
+        \advance\@tempdimb -\lst@frametextsep
+        \edef\lst@rulesep{\the\@tempdimb}%
     \fi
-    \lst@CheckMerge
-    {\lst@thestyle{\lst@FontAdjust
-     \setbox\@tempboxa\lst@hbox
-        {\lsthk@OutputBox
-         \lst@lefthss
-         \expandafter\lst@FillOutputBox\the\lst@token\@empty
-         \lst@righthss}%
-     \ht\@tempboxa=0pt\dp\@tempboxa=0pt
-     \lst@CalcLostSpaceAndOutput}}%
-    \lst@ResetToken}
+    \lst@frameMakeBoxV\lst@framebox{\ht\strutbox}{\dp\strutbox}%
+    %%%%  ここから
+    \@tempdima\z@
+    \ifdim\ht\strutbox<\cht\@tempdima=\dimexpr\cht-\ht\strutbox\relax\fi
+    \ifdim\dp\strutbox<\cdp\advance\@tempdima=\dimexpr\cdp-\dp\strutbox\relax\fi
+    \edef\lst@framelr{\lineskiplimit-\the\@tempdima\copy\lst@framebox}%
+    %%%% ここまで
+    \ifx\lst@frametshape\@empty\else
+        \lst@frameH T\lst@frametshape
+        \ifvoid\z@\else
+            \par\lst@parshape
+            \@tempdima-\baselineskip \advance\@tempdima\ht\z@
+            \ifdim\prevdepth<\@cclvi\p@\else
+                \advance\@tempdima\prevdepth
+            \fi
+            \ifdim\@tempdima<\z@
+                \vskip\@tempdima\vskip\lineskip
+            \fi
+            \noindent\box\z@\par
+            \lineskiplimit\maxdimen \lineskip\z@
+        \fi
+        \lst@frameSpreadV\lst@framextopmargin
+    \fi}
+
+
 
 %%%%%%%%%%%%%%%% escape to \LaTeX
 \lstloadaspects{escape}
index 0f0243b..74604fd 100644 (file)
Binary files a/test/test13-listings.pdf and b/test/test13-listings.pdf differ
index c6b3c34..4e2c8c2 100644 (file)
@@ -1,7 +1,7 @@
 %#!lualatex
 \documentclass{article}
 
-\usepackage{luatexja-fontspec}
+\usepackage{luatexja-fontspec,amsmath}
 \usepackage{listings,color,showexpl,comment}
 \usepackage{luatexja-otf}\directlua{luatexja.otf.enable_ivs()}
 \usepackage
        \fi
 }{}
 \DeclareKanjiFamily{JY3}{koz}{}
-\DeclareFontShape{JY3}{koz}{m}{n}{<-> s * [0.92489] KozMinPr6N-Regular:jfm=ujis}{}
-\DeclareFontShape{JY3}{koz}{m}{sl}{<-> s * [0.92489] psft:Ryumin-Light:jfm=ujis;slant=0.167}{}
+\DeclareFontShape{JY3}{koz}{m}{n}{<-> s * [1.2] KozMinPr6N-Regular:jfm=ujis}{}
+\DeclareFontShape{JY3}{koz}{m}{sl}{<-> s * [1.2] psft:Ryumin-Light:jfm=ujis;slant=0.167}{}
 \DeclareFontShape{JY3}{koz}{m}{it}{<-> ssub* koz/m/sl}{}
 \def\mcdefault{koz}
 
 \setmainfont{TeX Gyre Pagella}
 \setmonofont{TeX Gyre Cursor}
+\def\cs#1{\hbox{\texttt{\textbackslash #1}}}
 \begin{document}
 
 This test file is based on a.tex\footnote{This can be downloaded from {\tt https://gist.github.com/1574793}.} by x19290.
@@ -55,8 +56,12 @@ In this document, we define them by
 \end{lstlisting}
 \newpage
 
-We also avoid white band problem, by setting both the height and the depth of each 
-letter/word to 0\,pt. 
+We also avoid white band problem, by setting the value of \cs{lineskiplimit} to
+\begin{multline}
+ -\min(\cs{cht}-\cs{ht}\cs{strutbox}, 0)\\
+ -\min(\cs{cdp}-\cs{dp}\cs{strutbox}, 0).
+\end{multline}
+
 
 \begin{env}{\relax}
 #!/bin/sh
@@ -169,6 +174,7 @@ IVS対応2: \texttt{vsraw=true}
 1234567890
 1あ,23
 1あ2,3
+1)2,3
 1234567890
 \end{lstlisting}
 
@@ -183,5 +189,8 @@ foo \lstinline[basicstyle=\tt]!bar! baz あ
 foo \lstinline[basicstyle=\tt]!あbar! baz あ
 あ\lstinline[basicstyle=\tt]{いbar}hoge
 
+\bigskip
+\textbf{Ticket \#35484}
 
+\colorbox{red}{\lstinline!aiueoxyz!}
 \end{document}