Skip to content

Commit

Permalink
ctex: 依赖 chinese-jfm
Browse files Browse the repository at this point in the history
  • Loading branch information
qinglee committed May 26, 2022
1 parent ba4da26 commit dcb710b
Show file tree
Hide file tree
Showing 27 changed files with 758 additions and 1,372 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ env:
booktabs
caption
carlisle
chinese-jfm
cjkpunct
cleveref
context
Expand Down
51 changes: 33 additions & 18 deletions ctex/ctex.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ Copyright and Licence
% \changes{v2.4.15}{2019/03/23}{同步 \LaTeXiii{} 2019/03/05。}
% \changes{v2.5.1}{2020/05/02}{\pkg{zhconv} 更名为 \pkg{ctex-zhconv}。}
%
% \CheckSum{6420}
% \CheckSum{6430}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
Expand Down Expand Up @@ -3211,6 +3211,7 @@ Copyright and Licence
% \item \pkg{ltxcmds} 宏包。
% \item \pkg{pdftexcmds} 宏包。
% \item \pkg{xkeyval} 宏包。
% \item \pkg{chinese-jfm} 宏包。
% \end{itemize}
% \item \pkg{fontspec} 宏包。
% \item[\ding{229}] 以上是使用 \LuaLaTeX{} 编译时的依赖项。
Expand Down Expand Up @@ -4860,14 +4861,6 @@ Copyright and Licence
end, "global")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ctex_ltj_use_jfont:}
% 使用 jfont,确保当前的 \tn{font} 是 jfont。
% \begin{macrocode}
newluacmd("ctex_ltj_use_jfont:", function ()
font.current(getattribute("ltj@curjfnt"))
end, "global", "protected")
% \end{macrocode}
% \end{macro}
% \begin{macro}{\ctex_ltj_set_alt_font:nnnn}
% |#1| 和 |#2| 分别是字符区间的首末,|#3| 是基础字体,|#4| 是替代字体。
% \begin{macrocode}
Expand Down Expand Up @@ -5057,6 +5050,14 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ctex_ltj_use_jfont:}
% 使用 jfont,确保当前的 \tn{font} 是 jfont。
% \begin{macrocode}
\cs_new_protected_nopar:Npn \ctex_ltj_use_jfont:
{ \tex_setfontid:D \ltj@curjfnt }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[int]{\ctex_ltj_subst_font:}
% \tn{do@subst@correction} 在设置通过 \texttt{sub} 或者 \texttt{ssub} 函数定义的
% 字体时会用到。如果没有设置 \opt{SlantedFont},\pkg{fontspec} 会设置
Expand Down Expand Up @@ -5285,19 +5286,33 @@ Copyright and Licence
%
% \paragraph{字体族的定义与使用}
%
% \begin{macro}[int]{\ctex_mono_jfm:n}
% \begin{variable}{\l_@@_jfm_tl}
% \pkg{LuaTeX-ja} 中与标点格式 \opt{plain} 对应的 \texttt{JFM} 是 \opt{mono}。
% \changes{v2.5.9}{2022/05/26}{依赖 \pkg{chinese-jfm} 宏包。}
%
% \begin{macro}[int]{\ctex_set_jfm:n}
% \begin{variable}{\l_@@_jfm_tl, \l_@@_redirect_jfm_prop}
% 设置 \texttt{JFM},需要进行一些重定向操作。
% \begin{macrocode}
\cs_new_protected:Npn \ctex_mono_jfm:n #1
\cs_new_protected:Npn \ctex_set_jfm:n #1
{
\str_if_eq:nnTF {#1} { plain }
{ \tl_set:Nn \l_@@_jfm_tl { mono } }
\prop_get:NnNF \l_@@_redirect_jfm_prop {#1} \l_@@_jfm_tl
{ \tl_set:Nn \l_@@_jfm_tl {#1} }
}
\cs_generate_variant:Nn \ctex_set_jfm:n { o }
\prop_new:N \l_@@_redirect_jfm_prop
\prop_set_from_keyval:Nn \l_@@_redirect_jfm_prop
{
plain = mono ,
quanjiao = zh_CN / quanjiao ,
banjiao = zh_CN / banjiao ,
kaiming = zh_CN / kaiming
}
\keys_define:nn { ctex_ltj / fontspec }
{
JFM .code:n = \ctex_set_jfm:n {#1} ,
JFM .value_required:n = true
}
\tl_new:N \l_@@_jfm_tl
\cs_generate_variant:Nn \ctex_mono_jfm:n { o }
\ctex_mono_jfm:o { \l__ctex_punct_tl }
\ctex_set_jfm:o { \l__ctex_punct_tl }
% \end{macrocode}
% \end{variable}
% \end{macro}
Expand Down Expand Up @@ -6966,7 +6981,7 @@ Copyright and Licence
\tl_set:Nx \l_@@_punct_tl {#1}
%<pdftex> \punctstyle { \l_@@_punct_tl }
%<xetex> \xeCJKsetup { PunctStyle = \l_@@_punct_tl }
%<luatex> \ctex_mono_jfm:o { \l_@@_punct_tl }
%<luatex> \ctex_set_jfm:o { \l_@@_punct_tl }
%<uptex|aptex> \msg_warning:nn { ctex } { invalid-option }
} ,
punct .default:n = { quanjiao } ,
Expand Down
38 changes: 19 additions & 19 deletions ctex/test/testfiles/basic01.luatex.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Completed box being shipped out [2]
....\glue(\rightskip) 0.0
...\penalty 150
...\glue(\baselineskip) 4.89558
...\hbox(9.27464+1.26472)x345.0, glue set - 0.2656, direction TLT
...\hbox(9.27464+1.26472)x345.0, glue set - 0.1328, direction TLT
....\whatsit4=[]
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 档
Expand Down Expand Up @@ -255,7 +255,7 @@ Completed box being shipped out [2]
....\glue 0.0 plus 0.60931
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 标
....\glue 0.0 plus 0.60931
Expand All @@ -271,7 +271,7 @@ Completed box being shipped out [2]
....\glue 0.0 plus 0.60931
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 字
....\glue 0.0 plus 0.60931
Expand All @@ -293,7 +293,7 @@ Completed box being shipped out [2]
....\glue 0.0 plus 0.60931
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 标
....\glue 0.0 plus 0.60931
Expand All @@ -315,7 +315,7 @@ Completed box being shipped out [2]
....\glue 0.0 plus 0.60931
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 中
....\glue 0.0 plus 0.60931
Expand All @@ -326,7 +326,7 @@ Completed box being shipped out [2]
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 版
....\glue(\rightskip) 0.0
...\glue(\baselineskip) 5.90208
...\hbox(9.27464+1.26472)x345.0, glue set - 0.17706, direction TLT
...\hbox(9.27464+1.26472)x345.0, glue set - 0.10623, direction TLT
....\whatsit4=[]
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 式
Expand All @@ -340,7 +340,7 @@ Completed box being shipped out [2]
....\glue 0.0 plus 0.60931
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 数
....\glue 0.0 plus 0.60931
Expand Down Expand Up @@ -396,7 +396,7 @@ Completed box being shipped out [2]
....\glue 0.0 plus 0.60931
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 报
....\glue 0.0 plus 0.60931
Expand All @@ -406,7 +406,7 @@ Completed box being shipped out [2]
....\glue 0.0 plus 0.60931
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 书
....\glue 0.0 plus 0.60931
Expand All @@ -416,7 +416,7 @@ Completed box being shipped out [2]
....\glue 0.0 plus 0.60931
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 幻
....\glue 0.0 plus 0.60931
Expand Down Expand Up @@ -470,7 +470,7 @@ Completed box being shipped out [2]
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
...\glue(\baselineskip) 5.90208
...\hbox(9.27464+2.27122)x345.0, glue set - 0.60384, direction TLT
...\hbox(9.27464+2.27122)x345.0, glue set - 0.33208, direction TLT
....\whatsit4=[]
....\localpar
.....\localinterlinepenalty=0
Expand Down Expand Up @@ -511,7 +511,7 @@ Completed box being shipped out [2]
....\glue 0.0
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\TU/lmr/m/n/10.53937 p
....\kern0.2951 (font)
....\TU/lmr/m/n/10.53937 d
Expand All @@ -528,7 +528,7 @@ Completed box being shipped out [2]
....\glue 0.0
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\TU/lmr/m/n/10.53937 X
....\TU/lmr/m/n/10.53937 e
....\discretionary (penalty 50)
Expand All @@ -545,7 +545,7 @@ Completed box being shipped out [2]
....\glue 0.0
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\TU/lmr/m/n/10.53937 L
....\TU/lmr/m/n/10.53937 u
....\discretionary (penalty 50)
Expand All @@ -563,7 +563,7 @@ Completed box being shipped out [2]
....\glue 0.0
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\TU/lmr/m/n/10.53937 u
....\TU/lmr/m/n/10.53937 p
....\discretionary (penalty 50)
Expand All @@ -579,7 +579,7 @@ Completed box being shipped out [2]
....\glue(\rightskip) 0.0
...\penalty 150
...\glue(\baselineskip) 4.89558
...\hbox(9.27464+1.26472)x345.0, glue set - 0.66054, direction TLT
...\hbox(9.27464+1.26472)x345.0, glue set - 0.36327, direction TLT
....\whatsit4=[]
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 等
Expand Down Expand Up @@ -654,7 +654,7 @@ Completed box being shipped out [2]
....\glue 0.0 plus 0.60931
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 。
....\glue 5.26968
....\glue 5.26968 minus 5.26968
....\hbox(9.27464+1.26472)x10.53937, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 主
....\glue 0.0 plus 0.60931
Expand Down Expand Up @@ -714,7 +714,7 @@ Completed box being shipped out [2]
....\glue 0.0
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\TU/lmr/m/n/10.53937 c
....\TU/lmr/m/n/10.53937 t
....\TU/lmr/m/n/10.53937 e
Expand All @@ -726,7 +726,7 @@ Completed box being shipped out [2]
....\glue 0.0
....\hbox(9.27464+1.26472)x5.26968, direction TLT
.....\LTJY3/FandolSong-Regular(0)/m/n/10.53937 、
....\glue 5.26968 minus 2.63484
....\glue 5.26968 minus 5.26968
....\TU/lmr/m/n/10.53937 c
....\TU/lmr/m/n/10.53937 t
....\TU/lmr/m/n/10.53937 e
Expand Down
Loading

0 comments on commit dcb710b

Please sign in to comment.