summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/patches
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/patches')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty14
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty58
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty185
3 files changed, 216 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
index 03f4aaf170d..3fbc35372c9 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
@@ -31,7 +31,8 @@
\DeclareFontShape{JY3}{gt}{bx}{n}{<-> ssub*gt/m/n}{}
%fontencoding{JT3}\selectfont
-\fontencoding{JY3}\selectfont
+\fontencoding{JY3}\selectfont\adjustbaseline
+
\DeclareTextFontCommand{\textmc}{\mcfamily}
\DeclareTextFontCommand{\textgt}{\gtfamily}
\DeclareOldFontCommand{\mc}{\normalfont\mcfamily}{}
@@ -51,10 +52,10 @@
"500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF,
"2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB00-"FE0F,
"FE20-"FE2F, "FE70-"FEFF, "10000-"1FFFF, "E000-"F8FF} % non-Japanese
-\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"10FFFF}
+\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF}
\ltjdefcharrange{6}{%
"2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF,
- "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF}
+ "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF, "E0100-"E01EF}
\ltjdefcharrange{7}{
"1100-"11FF, "2F00-"2FFF, "3100-"31EF, "A000-"A4CF, "A830-"A83F,
"AC00-"D7FF}
@@ -112,8 +113,8 @@ NEGATIVE
"FE20-"FE2F, "FE70-"FEFF, "10000-"1FFFF, "E000-"F8FF}
} % non-Japanese
-\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"10FFFF}
- % Surrogates, Tags and Variation Selectors Supplement
+\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF}
+ % Surrogates, Tags
% 208 "F0000-"FFFFF num = 0/65536 name = Supplementary Private Use Area-A
% 209 "100000-"10FFFF num = 0/65536 name = Supplementary Private Use Area-B
@@ -122,7 +123,7 @@ POSITIVE
% Japanese
\ltjdefcharrange{6}{%
"2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF,
- "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF}
+ "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF, "E0100-"E01EF}
% 77 "2460-"24FF num = 150/160 name = Enclosed Alphanumerics
% 98 "2E80-"2EFF num = 21 name = CJK Radicals Supplement
% 101 "3000-"303F num = 144 name = CJK Symbols and Punctuation
@@ -139,6 +140,7 @@ POSITIVE
% 149 "FE30-"FE4F num = 8/32 name = CJK Compatibility Forms
% 150 "FE50-"FE6F num = 0/32 name = Small Form Variants
% SIP
+% "E0000-"E01EF Variation Selectors Supplement
\ltjdefcharrange{7}{
"1100-"11FF, "2F00-"2FFF, "3100-"31EF, "A000-"A4CF, "A830-"A83F,
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
index 00cb175ccaa..244ae453df2 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
@@ -536,7 +536,6 @@
\romanseries{\seriesdefault}%
\romanshape{\shapedefault}%
\selectfont\ignorespaces}
-\adjustbaseline
\let\reset@font\normalfont
\DeclareRobustCommand\mcfamily
{\not@math@alphabet\mcfamily\mathmc
@@ -583,8 +582,15 @@
\fi
\let\getjfont\font@name}
+% 異なる和文 enc/fam/ser/shape からは異なるフォント番号が振られるように
+% わざと「ゴミをつける」
+\def\ltj@@patch@external@font#1 at{%
+ #1;\directlua{luatexja.jfont.print_aftl_address(%
+ '\luatexluaescapestring{\f@encoding/\f@family/\f@series/\f@shape}')}\space at%
+}
\def\extract@jfont{%
- \get@external@font
+ \get@external@font
+ \edef\external@font{\expandafter\ltj@@patch@external@font\external@font}%
\expandafter\globaljfont\font@name\external@font\relax
\font@name%\global\zw=\zw\global\zh=\zh
\csname \f@encoding+\f@family\endcsname
@@ -641,4 +647,52 @@
\ifin@\jfam#2\relax\else\mathgroup#2\relax\fi
\expandafter\math@egroup\fi}%
+%%%%%% Alternate Japanese Fonts
+%%%% \DeclareAlternateKanjiFont<Benc><Bfam><Bser><Bshape><Aenc><Afam><Aser><Ashape><range>
+% いつも global
+\def\DeclareAlternateKanjiFont#1#2#3#4#5#6#7#8#9{%
+ {\def\ltj@temp@bfont{#1/#2/#3/#4}\def\ltj@temp@afont{#5/#6/#7/#8}%
+ \expandafter\ltj@@altfont@latex#9,,}\ignorespaces}
+\def\ltj@@altfont@latex#1,{\def\ltj@temp{#1}%
+ \ifx\ltj@temp\empty\let\@next=\relax\else
+ \ltj@@altfont@latexA{#1}\let\@next=\ltj@@altfont@latex\fi\@next}
+\def\ltj@@altfont@latexA#1{\ltj@@altfont@latexB#1--\@nil}
+\def\ltj@@altfont@latexB#1-#2-#3\@nil{\def\ltj@temp{#3}%
+ \ifx\ltj@temp\empty
+ \ltj@tempcnta=#1\relax\ltj@tempcntb=\ltj@tempcnta
+ \else
+ \def\ltj@temp{#1}%
+ \ifx\ltj@temp\empty\ltj@tempcnta='200\else\ltj@tempcnta=#1\fi\relax
+ \def\ltj@temp{#2}%
+ \ifx\ltj@temp\empty\ltj@tempcntb="10FFFF\else\ltj@tempcntb=#2\fi\relax%"
+ \fi
+ \directlua{luatexja.jfont.set_alt_font_latex(
+ \the\ltj@tempcnta,\the\ltj@tempcntb,
+ '\luatexluaescapestring{\ltj@temp@afont}',
+ '\luatexluaescapestring{\ltj@temp@bfont}')}%
+ }
+
+%%%% \ClearAlternateKanjiFont<Benc><Bfam><Bser><Bshape>
+% いつも global
+\def\ClearAlternateKanjiFont#1#2#3#4{%
+ \directlua{luatexja.jfont.clear_alt_font_latex(
+ '\luatexluaescapestring{#1/#2/#3/#4}')}}
+
+% \selectfont 上書き
+\let\ltj@@alt@selectfont@orig=\selectfont
+\def\selectfont{%
+ \ltj@@alt@selectfont@orig
+ % alt fonts の定義
+ \directlua{luatexja.jfont.output_alt_font_cmd('\luatexluaescapestring{\curr@kfontshape}')}%
+ % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
+ \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
+}
+\def\ltj@pickup@altfont@aux#1{%
+ {\edef\font@name{\csname #1/\f@size\endcsname}\pickup@jfont}%
+}
+\def\ltj@pickup@altfont@copy#1#2{%
+ \ltj@@getjfontnumber#1%
+ \directlua{luatexja.jfont.pickup_alt_font_b(\the\ltj@tempcntc,'\luatexluaescapestring{#2}')}%
+}
+
\endinput
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 4787bcc89a8..06f0918140c 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjp-listings.sty
@@ -3,45 +3,81 @@
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-listings}[2013/05/14 Patch to listings for LuaTeX-ja]
+\ProvidesPackage{lltjp-listings}[2014/01/09 Patch to listings for LuaTeX-ja]
\RequirePackage{listings,luatexbase-cctb}
+%%%%%%%%%%%%%%%% Japanese support
+%% IVS support
+\newif\if@ltj@lst@vsraw \@ltj@lst@vsrawfalse
+\def\ltj@lst@vscmd{}
+\lst@Key{vsraw}f[t]{\lstKV@SetIf{#1}\if@ltj@lst@vsraw}
+\lst@Key{vscmd}\relax{\def\ltj@lst@vscmd{#1}}
+
+% 既定の IVS 出力コマンド
+\def\ltjlistingsvsstdcmd#1{\@tempdima=\f@size pt%
+ \smash{\raisebox{.35\@tempdima}{\tt%
+ \fboxsep=.1\@tempdima\fbox{\fontsize{.5\@tempdima}{\z@}\selectfont
+ \oalign{\hss VS\hss\crcr#1\crcr}}}}}
+\def\ltj@lst@vscmd{\ltjlistingsvsstdcmd}
+
+% override \lst@FillFixed@
+% \ltj@hst@hss is \ltj@lst@hss@ivs or \ltj@lst@hss@normal,
+% according to vsraw = true or not.
+\def\lst@FillFixed@#1{%
+ \ifx\@empty#1\else\ltj@lst@hss#1\expandafter\lst@FillFixed@\fi}
+
+\directlua{
+ local cat_str = luatexbase.catcodetables['string']
+ local cat_lp = luatexbase.catcodetables['latex-package']
+ local ubyte = unicode.utf8.byte
+ luatexja.lst = {}
+ function luatexja.lst.althss(t)
+ t = ubyte(t)
+ if not (t>=0xE0100 and t<0xE01F0) then
+ tex.sprint(cat_lp, string.char(0x5C) .. 'lst@hss')
+ end
+ end
+}
+\gdef\ltj@lst@hss@ivs#1{%
+ \directlua{luatexja.lst.althss('\luatexluaescapestring{#1}')}#1%
+}
+
% lowest level
-\def\lst@kanjitrue{\let\lst@ifkanji\iftrue}
-\def\lst@kanjifalse{\let\lst@ifkanji\iffalse}
-\lst@AddToHook{InitVars}{\lst@kanjifalse}
+\newif\if@ltj@lst@kanji
+\lst@AddToHook{InitVars}{\@ltj@lst@kanjifalse}
\def\lst@AppendLetter{%
\ltj@lst@setletterflag\lst@Append}
\def\lst@AppendOther{%
- \lst@ifletter\lst@Output\lst@letterfalse\fi\lst@kanjifalse
+ \lst@ifletter\lst@Output\lst@letterfalse\fi\@ltj@lst@kanjifalse
\futurelet\lst@lastother\lst@Append}
\def\ltj@lst@setletterflag{%
\lst@ifletter
- \lst@ifkanji\lst@Output\lst@kanjifalse\fi
+ \if@ltj@lst@kanji\lst@Output\@ltj@lst@kanjifalse\fi
\else
- \lst@lettertrue\lst@ifkanji\lst@kanjifalse\else\lst@OutputOther\fi
+ \lst@lettertrue\if@ltj@lst@kanji\@ltj@lst@kanjifalse\else\lst@OutputOther\fi
\fi}
\def\ltj@lst@setkanjiflag{%
\lst@ifletter
\lst@Output
\else
- \lst@ifkanji\else\lst@OutputOther\fi\lst@lettertrue
+ \if@ltj@lst@kanji\else\lst@OutputOther\fi\lst@lettertrue
\fi}
\def\ltj@lst@setopenflag{%
\lst@ifletter
\lst@letterfalse\lst@Output
\else
- \lst@ifkanji\else\lst@OutputOther\fi
- \fi\lst@kanjitrue}
+ \if@ltj@lst@kanji\else\lst@OutputOther\fi
+ \fi\@ltj@lst@kanjitrue}
\def\ltj@lst@setcloseflag{%
- \lst@ifletter\else\lst@lettertrue\fi\lst@kanjitrue}
+ \lst@ifletter\else\lst@lettertrue\fi\@ltj@lst@kanjitrue}
-\def\lst@ProcessJALetter#1{%
+% Processing Japanese characters
+\def\ltj@lst@ProcessJALetter#1{%
\lst@whitespacefalse
\ifnum\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{`#1}}=0
\ifnum\ltjgetparameter{postbreakpenalty}{`#1}>0
@@ -58,7 +94,8 @@
\fi
\lst@Append#1}
-\def\lst@ProcessJALetterHalf#1{%
+% 半角カナ処理命令
+\def\ltj@lst@ProcessJALetterHalf#1{%
\lst@whitespacefalse
\ifnum\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{`#1}}=0
\ifnum\ltjgetparameter{postbreakpenalty}{`#1}>0
@@ -75,22 +112,27 @@
\fi
\lst@Append#1}
+% 漢字用異体字セレクタ命令
+\def\ltj@lst@ProcessIVS#1{%
+ \lst@whitespacefalse
+ \if@ltj@lst@vsraw
+ \lst@Append#1\advance\lst@length\m@ne
+ \else
+ \lst@TrackNewLines\lst@OutputLostSpace \lst@PrintToken
+ \setbox\@tempboxa\hbox to 2\lst@width{\hss
+ \expandafter\expandafter\expandafter\ltj@lst@vscmd
+ \expandafter{\the\numexpr`#1-"E00EF\relax}%"
+ \hss}%
+ \lst@CalcLostSpaceAndOutput\lst@whitespacefalse
+ \fi
+}
-% 半角カナの扱い
+% 半角カナ,異体字セレクタはアクティブ化
\def\ltj@@listing@jpsetN#1#2#3{% for (not large) range
- \@tempcnta=#1 \@tempcntb=\numexpr 1+#2\relax \@temptokena{}%
+ \@tempcnta=\numexpr#1-1\relax\@tempcntb=\numexpr 1+#2\relax
\loop \global\advance\@tempcnta\@ne\ifnum\@tempcnta<\@tempcntb\relax
\ltj@@listing@jpsetN@{\@tempcnta}{#3}\repeat
- \ltj@@listing@jpset@after{#1}
-}
-
-\def\ltj@@listing@jpset@after#1{%
- \expandafter\edef\csname ltj@@listing@jpcmd@i#1\endcsname{\the\@temptokena}%
- \toks@\expandafter\expandafter\expandafter\expandafter%
- \expandafter\expandafter\expandafter{\expandafter\expandafter%
- \expandafter\the\expandafter\toks@\csname ltj@@listing@jpcmd@i#1\endcsname}%
- \@temptokena{}%
}
\def\ltj@@listing@jpsetN@#1#2{{%
@@ -100,23 +142,42 @@
\expandafter\expandafter\expandafter{\expandafter\expandafter%
\expandafter\the\expandafter\@temptokena\@temp}%
}
-
-\toks@{}
-\ltj@@listing@jpsetN{65377}{65439}{\lst@ProcessJALetterHalf}
-\edef\ltj@@listing@jpcmd{\the\toks@}\toks@{}
+\@temptokena{}
+\ltj@@listing@jpsetN{65377}{65439}{\ltj@lst@ProcessJALetterHalf}
+\ltj@@listing@jpsetN{917760}{917999}{\ltj@lst@ProcessIVS}
+\xdef\ltj@@listing@jpcmd{\the\@temptokena}\@temptokena{}
% catcode 対策
\newluatexcatcodetable\CatcodeTableLTJlistings
-\setluatexcatcodetable\CatcodeTableLTJlistings{
+\setluatexcatcodetable\CatcodeTableLTJlistings{%
\luatexcatcodetable\CatcodeTableLaTeXAtLetter
\catcode"FFFFF=13%"
- \setcatcoderange{"FF61}{"FF9F}{13}% 半角文字
+ \SetCatcodeRange{"FF61}{"FF9F}{13}% 半角カナ
+ \SetCatcodeRange{"E0100}{"E01EF}{13}% 漢字用異体字セレクタ
}
+% We redefine \lst@BeginDropInput, since now we have
+% two additional `process macros'.
+\def\lst@BeginDropInput#1{%
+ \lst@EnterMode{#1}%
+ {\lst@modetrue
+ \let\lst@OutputBox\@gobble
+ \let\lst@ifdropinput\iftrue
+ \let\lst@ProcessLetter\@gobble
+ \let\lst@ProcessDigit\@gobble
+ \let\lst@ProcessOther\@gobble
+ \let\lst@ProcessSpace\@empty
+ \let\lst@ProcessTabulator\@empty
+ \let\lst@ProcessFormFeed\@empty
+ \let\ltj@lst@ProcessJALetter\@gobble % added
+ \let\ltj@lst@ProcessJALetterHalf\@gobble % added
+}}
+
+
% hook!
\lst@AddToHook{Init}{
\luatexcatcodetable\CatcodeTableLTJlistings\ltj@@listing@jpcmd
- \lccode`\~="FFFFF\lowercase{\let~\lst@ProcessJALetter}%"
+ \lccode`\~="FFFFF\lowercase{\def~{\ltj@lst@ProcessJALetter}}%"
\directlua{luatexbase.add_to_callback('process_input_buffer',
function(buf)
local ret = ''
@@ -129,8 +190,17 @@
ret = ret .. c
end
return ret
- end, 'ltj.listings_unicode', 1)}}
-\lst@AddToHook{ExitVars}{\directlua{luatexbase.remove_from_callback('process_input_buffer', 'ltj.listings_unicode')}}
+ end, 'ltj.listings_unicode', 1)}%
+ \if@ltj@lst@vsraw
+ \let\ltj@lst@hss=\ltj@lst@hss@ivs
+ \else
+ \let\ltj@lst@hss=\lst@hss
+ \fi
+}
+\lst@AddToHook{ExitVars}{%
+ \directlua{luatexbase.remove_from_callback('process_input_buffer',
+ 'ltj.listings_unicode')}%
+}
% 白線対策
@@ -151,6 +221,55 @@
\lst@CalcLostSpaceAndOutput}}%
\lst@ResetToken}
+%%%%%%%%%%%%%%%% escape to \LaTeX
+\lstloadaspects{escape}
+\gdef\lst@Escape#1#2#3#4{%
+ \lst@CArgX #1\relax\lst@CDefX
+ {}%
+ {\lst@ifdropinput\else
+ \lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken
+ \lst@InterruptModes
+ \lst@EnterMode{\lst@TeXmode}{\lst@modetrue}%
+ \ifx\^^M#2%
+ \lst@CArg #2\relax\lst@ActiveCDefX
+ {}%
+ {\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes}%
+ {\lst@MProcessListing}%
+ \else
+ \lst@CArg #2\relax\lst@ActiveCDefX
+ {}%
+ {\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes
+ \lst@newlines\z@ \lst@whitespacefalse}%
+ {}%
+ \fi
+ #3\catcode"FFFFF=9\lst@escapebegin%"
+ \fi}%
+ {}}
+
+%%%%%%%%%%%%%%%%
+\lstloadaspects{writefile}
+\begingroup \catcode`\^^I=11
+\gdef\lst@WFBegin#1#2{%
+ \begingroup
+ \let\lst@OutputBox#1%
+ \def\lst@Append##1{%
+ \advance\lst@length\@ne
+ \expandafter\lst@token\expandafter{\the\lst@token##1}%
+ \ifx ##1\lst@outputspace \else
+ \lst@WFAppend##1%
+ \fi}%
+ \lst@lAddTo\lst@PreGotoTabStop{\lst@WFAppend{^^I}}%
+ \lst@lAddTo\lst@ProcessSpace{\lst@WFAppend{ }}%
+ \def\ltj@lst@ProcessIVS##1{\lst@whitespacefalse\lst@Append##1}
+ \let\lst@DeInit\lst@WFDeInit
+ \let\lst@MProcessListing\lst@WFMProcessListing
+ \lst@WFifopen\else
+ \immediate\openout\lst@WF=#2\relax
+ \global\let\lst@WFifopen\iftrue
+ \@gobbletwo\fi\fi
+ \fi}
+\endgroup
+
% \begin{修正事項}{1.3} from jlisting.sty
% ちょっとした修正