ソースコードの管理場所
修订版 | 5b1b236a2d586ae8121b953fec9d3714527aa7dd (tree) |
---|---|
时间 | 2016-02-07 15:57:24 |
作者 | Hironori Kitagawa <h_kitagawa2001@yaho...> |
Commiter | Hironori Kitagawa |
lltjfont.sty: \adjustbaseline is re-implemented by luafunction
@@ -24,6 +24,7 @@ | ||
24 | 24 | |
25 | 25 | %%%%%%%% fonts |
26 | 26 | \usepackage{luatexja-otf} |
27 | +\directlua{luatexja.otf.enable_ivs()} | |
27 | 28 | \usepackage[no-math]{fontspec} |
28 | 29 | \setmainfont[Ligatures=TeX]{Linux Libertine O} |
29 | 30 | \setmonofont[Scale=MatchLowercase, ItalicFont=lmmono10-italic.otf, |
@@ -5240,11 +5241,11 @@ in \pTeX, and symbols beside each parameter has the following meaning: | ||
5240 | 5241 | %</ja> |
5241 | 5242 | \begin{itemize} |
5242 | 5243 | %<*en> |
5243 | -\item ``\ast'' : values at the end of a paragraph or a hbox are | |
5244 | +\item ``$\ast$'' : values at the end of a paragraph or a hbox are | |
5244 | 5245 | adopted in the whole paragraph or the whole hbox. |
5245 | 5246 | %</en> |
5246 | 5247 | %<*ja> |
5247 | -\item ``\ast'':段落やhboxの終端での値がその段落/hbox全体で用いられる. | |
5248 | +\item ``$\ast$'':段落やhboxの終端での値がその段落/hbox全体で用いられる. | |
5248 | 5249 | %</ja> |
5249 | 5250 | %<*en> |
5250 | 5251 | \item ``\dagger'': assignments are always global. |
@@ -6159,8 +6160,10 @@ to match the vertical center of ``M'' and that of ``あ'' in vertical typesetti | ||
6159 | 6160 | + d_{\text{あ}} - d_{\text{M}}, |
6160 | 6161 | \] |
6161 | 6162 | where $h_{a}$~and~$d_{a}$ denote the height of ``$a$'' and the depth, respectively. |
6162 | -In \LuaTeX-ja, this \cs{adjustbaseline} does same task, namely setting the | |
6163 | +In \LuaTeX-ja, this \cs{adjustbaseline} does similar task, namely setting the | |
6163 | 6164 | \Param{talbaselineshift} parameter. |
6165 | +If the \LaTeX\ is 2015/10/01 release or later, \LuaTeX-ja use a Japanese | |
6166 | +character whose character class is zero, instead of `あ'. | |
6164 | 6167 | %</en> |
6165 | 6168 | %<*ja> |
6166 | 6169 | \pLaTeXe では,\cs{adjustbaseline} は縦組時に「M」と「あ」の中心線を一致させるために, |
@@ -6174,8 +6177,12 @@ In \LuaTeX-ja, this \cs{adjustbaseline} does same task, namely setting the | ||
6174 | 6177 | \LuaTeX-jaにおいても\cs{adjustbaseline} は同様に\Param{talbaselineshift}パラメータの調整処 |
6175 | 6178 | 理を行っている. |
6176 | 6179 | |
6177 | -同時に,これも\pLaTeXe の \cs{adjustbaseline} で行われていたが, | |
6178 | -「漢」の寸法を元に,(本節の最初に述べた,小文字で始まる)\cs{cht}, \cs{cwd} といった長さ変数を設定する. | |
6180 | +同時に,これも\pLaTeXe の \cs{adjustbaseline} で同様の処理が行われていたが, | |
6181 | +「漢」の寸法を元に(本節の最初に述べた,小文字で始まる)\cs{cht}, \cs{cwd} | |
6182 | +といった長さ変数を設定する. | |
6183 | + | |
6184 | +なお,\LaTeX が2015/10/01 版以降の場合は,「あ」「漢」の代わりに | |
6185 | +「文字クラス0の和文文字」を用いる. | |
6179 | 6186 | %</ja> |
6180 | 6187 | |
6181 | 6188 | \item[\cs{fontfamily}\{<family>\}] |
@@ -6774,16 +6781,13 @@ JFMの\texttt{chars}テーブルのエントリとして \verb+'AJ1-xxx'+ の形 | ||
6774 | 6781 | 正しく半角幅で組むために利用されている. |
6775 | 6782 | %</ja> |
6776 | 6783 | |
6777 | -\directlua{luatexja.otf.enable_ivs()} | |
6778 | 6784 | %<*en> |
6779 | 6785 | \paragraph{IVS support} |
6780 | 6786 | Recent fonts support Ideographic Variation Selector (IVS). |
6781 | 6787 | It seems that \Pkg{luaotfload} and \Pkg{fontspec} packages do not support |
6782 | 6788 | IVS, so we implemented IVS support in \Pkg{luatexja-otf}. |
6783 | 6789 | \emph{IVS support by the \Pkg{luatexja-otf} package is experimental. |
6784 | -If this feature is enabled with current \LuaTeX\ (not with LuaJIT\TeX), | |
6785 | -we cannot use any OpenType feature, including {\tt vert}~and~{\tt vrt2}, | |
6786 | -in vertical writing mode. If you want to enable IVS support nevertheless, load | |
6790 | +If you want to enable IVS support, load | |
6787 | 6791 | \Pkg{luatexja-otf} and execute the following:} |
6788 | 6792 | %</en> |
6789 | 6793 | %<*ja> |
@@ -6798,14 +6802,10 @@ IVSに対応してはいないようである.これらのパッケージで | ||
6798 | 6802 | |
6799 | 6803 | \medskip |
6800 | 6804 | |
6801 | -\emph{\Pkg{luatexja-otf}によるIVS対応は試験的なものである.現行の\LuaTeX | |
6802 | -でIVS対応を一旦有効にすると,縦組時に句読点などが横組用字形のままで組版されたり, | |
6803 | -\Pkg{luaotfload}によるOpenType | |
6804 | -featureが(\texttt{vert},~\texttt{vrt2}を含め)一切効かないといった | |
6805 | -不具合がある\footnote{なぜかLuaJIT\TeX では大丈夫である.}.} | |
6806 | -そのような不具合を知りながら有効にするには, | |
6805 | +\emph{\Pkg{luatexja-otf}によるIVS対応は試験的なものである. | |
6806 | +有効にするには, | |
6807 | 6807 | \Pkg{luatexja-otf}パッケージを読み込んだ上で以下の命令を実行する% |
6808 | -\footnote{この命令を2回以上実行しても意味がない.}: | |
6808 | +\footnote{この命令を2回以上実行しても意味がない.}:} | |
6809 | 6809 | %</ja> |
6810 | 6810 | \begin{lstlisting} |
6811 | 6811 | \directlua{luatexja.otf.enable_ivs()} |
@@ -3,7 +3,7 @@ | ||
3 | 3 | % |
4 | 4 | |
5 | 5 | \NeedsTeXFormat{LaTeX2e} |
6 | -\ProvidesPackage{lltjfont}[2015/08/28 Patch to NFSS2 for LuaTeX-ja] | |
6 | +\ProvidesPackage{lltjfont}[2016/02/07 Patch to NFSS2 for LuaTeX-ja] | |
7 | 7 | |
8 | 8 | \let\k@encoding\@empty |
9 | 9 | \let\ck@encoding\@empty |
@@ -368,22 +368,52 @@ | ||
368 | 368 | |
369 | 369 | \ifdefined\newluafunction |
370 | 370 | \newluafunction\ltj@@adjust@baseline@inner |
371 | + \begingroup\catcode`\~=12 | |
371 | 372 | \directlua{% |
373 | + local nulltable = {} | |
372 | 374 | local t = lua.get_functions_table() |
375 | + local getfont, dir_tate = font.getfont, luatexja.dir_table.dir_tate | |
376 | + local fmt, get_attr = luatexja.jfont.font_metric_table, tex.getattribute | |
377 | + local setdimen, set_attr = tex.setdimen, tex.setattribute | |
378 | + local dir = luatexja.unary_pars.direction | |
373 | 379 | t[\the\ltj@@adjust@baseline@inner] = function() |
374 | - local ft = luatexja.jfont.font_metric_table[ | |
375 | - tex.getattribute('ltj@curtfnt')] or {} | |
376 | - ft = ft and ft.char_type or {} | |
377 | - ft = ft and ft[0] or {} | |
378 | - local fm = font.getfont(font.current()).characters[77] or {} %% 'M' | |
379 | - tex.setattribute('ltj@tablshift', | |
380 | - 0.5*((fm.height or 0)- (fm.depth or 0) | |
381 | - - (ft.height or 0)+ (ft.depth or 0))) | |
380 | + local ft = fmt[get_attr('ltj@curtfnt')] or nulltable | |
381 | + ft = ft and ft.char_type or nulltable | |
382 | + local fk = ft and ft[0] or nulltable | |
383 | + local ht, dp, wd = fk.height or 0, fk.depth or 0, | |
384 | + fk.width or ft.zw or 0 | |
385 | + local fm | |
386 | + = ((getfont(font.current()) or nulltable) | |
387 | + .characters or nulltable)[77] or nulltable %% 'M' | |
388 | + set_attr('ltj@tablshift', | |
389 | + 0.5*((fm.height or 0)- (fm.depth or 0) - ht+ dp)) | |
390 | + if dir() ~= dir_tate then | |
391 | + ft = fmt[get_attr('ltj@curjfnt')] or nulltable | |
392 | + ft = ft and ft.char_type or nulltable | |
393 | + fk = ft and ft[0] or nulltable | |
394 | + ht, dp, wd = fk.height or 0, fk.depth or 0, | |
395 | + fk.width or ft.zw or 0 | |
396 | + end | |
397 | + setdimen('cht', ht); setdimen('cdp', dp) | |
398 | + setdimen('cwd', wd); setdimen('chs', wd) | |
399 | + setdimen('cHT', ht+dp) | |
382 | 400 | end |
383 | - } | |
384 | - \def\ltj@@adjust@baseline{\luafunction\ltj@@adjust@baseline@inner} | |
401 | + }\endgroup | |
402 | + \def\adjustbaseline{\luafunction\ltj@@adjust@baseline@inner | |
403 | + \cvs\normalbaselineskip} | |
385 | 404 | \else |
386 | - \def\ltj@@adjust@baseline{% | |
405 | + \newbox\adjust@box | |
406 | + \newbox\adjust@box@aux | |
407 | + \newdimen\adjust@dimen | |
408 | + \def\adjustbaseline{% | |
409 | + \setbox\adjust@box\hbox{% | |
410 | + \ltj@ykblshift\z@\ltj@tkblshift\z@ 漢}% | |
411 | + \cht\ht\adjust@box | |
412 | + \cdp\dp\adjust@box | |
413 | + \cwd\wd\adjust@box | |
414 | + \cvs\normalbaselineskip | |
415 | + \chs\cwd | |
416 | + \cHT\cht \advance\cHT\cdp | |
387 | 417 | \setbox\adjust@box@aux\hbox{\tate\ltj@tkblshift\z@ 漢}% |
388 | 418 | \setbox\adjust@box\hbox{\tate\ltj@tablshift\z@ M}% |
389 | 419 | \adjust@dimen\ht\adjust@box |
@@ -395,20 +425,6 @@ | ||
395 | 425 | \ltj@tablshift=\adjust@dimen |
396 | 426 | } |
397 | 427 | \fi |
398 | -\newbox\adjust@box | |
399 | -\newbox\adjust@box@aux | |
400 | -\newdimen\adjust@dimen | |
401 | -\def\adjustbaseline{% | |
402 | - \setbox\adjust@box\hbox{% | |
403 | - \ltj@ykblshift\z@\ltj@tkblshift\z@ 漢}% | |
404 | - \cht\ht\adjust@box | |
405 | - \cdp\dp\adjust@box | |
406 | - \cwd\wd\adjust@box | |
407 | - \cvs\normalbaselineskip | |
408 | - \chs\cwd | |
409 | - \cHT\cht \advance\cHT\cdp | |
410 | - \ltj@@adjust@baseline | |
411 | -} | |
412 | 428 | \DeclareRobustCommand\romanencoding[1]{% |
413 | 429 | \expandafter\ifx\csname T@#1\endcsname\relax |
414 | 430 | \@latex@error{Encoding scheme `#1' unknown}\@eha |
@@ -3,7 +3,7 @@ | ||
3 | 3 | % |
4 | 4 | |
5 | 5 | \NeedsTeXFormat{LaTeX2e} |
6 | -\ProvidesPackage{lltjp-listings}[2015/12/11 Patch to listings for LuaTeX-ja] | |
6 | +\ProvidesPackage{lltjp-listings}[2016/02/07 Patch to listings for LuaTeX-ja] | |
7 | 7 | \RequirePackage{listings,luatexbase-cctb} |
8 | 8 | |
9 | 9 | %%%%%%%%%%%%%%%% Japanese support |
@@ -286,7 +286,7 @@ | ||
286 | 286 | \else |
287 | 287 | \lst@lExtend\lst@arg{\lst@temp~}% |
288 | 288 | \expandafter\lst@InsideConvert@ |
289 | - \fi #2} | |
289 | + \fi#2} | |
290 | 290 | }\endgroup |
291 | 291 | |
292 | 292 | \lst@AddToHook{ExitVars}{% |
@@ -344,7 +344,7 @@ | ||
344 | 344 | |
345 | 345 | %%%%%%%%%%%%%%%% escape to \LaTeX |
346 | 346 | \lstloadaspects{escape} |
347 | -\gdef\lst@Escape#1#2#3#4{ | |
347 | +\gdef\lst@Escape#1#2#3#4{% | |
348 | 348 | \lst@CArgX #1\relax\lst@CDefX |
349 | 349 | {}% |
350 | 350 | {\lst@ifdropinput\else |