summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-10-11 20:25:38 +0000
committerKarl Berry <karl@freefriends.org>2021-10-11 20:25:38 +0000
commit5743624ea509ba5a2e1a933dc8e0327cc268ed8c (patch)
treed312c3f25c31e220c2c92d6b952b1a86873621ca /Master/texmf-dist
parent2077deb33c2d217375849387f233e7a7421e3fbd (diff)
hanzibox (11oct21)
git-svn-id: svn://tug.org/texlive/trunk@60737 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/xelatex/hanzibox/README.md26
-rw-r--r--Master/texmf-dist/doc/xelatex/hanzibox/hanzibox.pdfbin505041 -> 578525 bytes
-rw-r--r--Master/texmf-dist/source/xelatex/hanzibox/hanzibox.dtx1300
-rw-r--r--Master/texmf-dist/tex/xelatex/hanzibox/hanzibox.sty633
4 files changed, 1231 insertions, 728 deletions
diff --git a/Master/texmf-dist/doc/xelatex/hanzibox/README.md b/Master/texmf-dist/doc/xelatex/hanzibox/README.md
index 0daf1efe0e5..e325df7a491 100644
--- a/Master/texmf-dist/doc/xelatex/hanzibox/README.md
+++ b/Master/texmf-dist/doc/xelatex/hanzibox/README.md
@@ -1,4 +1,3 @@
-hanzibox
Boxed Chinese characters with Pinyin above and translation below based LaTeX3
=======
@@ -21,12 +20,15 @@ You can read the manual (in Chinese) for more details and examples.
Contributing
------------
-1. Gitee repository: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
-2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls).
+1. github repository:
+ 1. repository: [hanzibox-l3](https://github.com/registor/hanzibox-l3)
+ 2. Issues and pull requests are welcome. [issue](https://github.com/registor/hanzibox-l3/issues) or [pull request](https://github.com/registor/hanzibox-l3/pulls).
-=======
-hanzibox
-基于LaTeX3的汉字练习宏包
+2. gitee repository:
+ 1. repository: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
+ 2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls).
+
+基于LaTeX3的带注音和译文的汉字练习宏包
=======
`hanzibox`是一个用LaTeX3开发的LaTeX宏包,它提供了`\hanzibox`和`\hanzidialog` 两个命令。这两个命令分别用于排版汉字学习中带有或不带田字格、米字格等背景格子的汉字,并可以根据需要在汉字正上方显示拼音,在正下方显示译文。其中,`\hanzibox`命令能够根据汉字自动调用`xpinyin`宏包的`\xpinyin*`命令实现汉字注音。并且`\hanzibox`命令提供了`\hanzibox*`星号版本,其注音功能是通过自动调用`xpinyin`宏包的`\pinyin`命令实现的。`\hanzidialog`命令的注音功能是通过在拼音选项中手动插入`xpinyin`宏包`\pinyin`命令实现的。
@@ -41,10 +43,14 @@ hanzibox
### 参与贡献
---------------------
-1. 本项目由西北农林科技大学信息工程学院耿楠创建和维护
-2. 如果您愿意一同参与工作(不计报酬,免费自由),请及时与作者联系
-3. 项目的gitee仓库地址:[hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
-4. 如果您有任何改进意见或者功能需求,欢迎提交 [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) 或 [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls)。
+
+1. github仓库:
+ (1). 仓库地址: [hanzibox-l3](https://github.com/registor/hanzibox-l3)
+ (2). Issues和PR: [issue](https://github.com/registor/hanzibox-l3/issues) or [pull request](https://github.com/registor/hanzibox-l3/pulls).
+
+2. gitee仓库:
+ (1). 仓库地址: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
+ (2). Issues and PR: [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls).
Copyright and Licence
---------------------
diff --git a/Master/texmf-dist/doc/xelatex/hanzibox/hanzibox.pdf b/Master/texmf-dist/doc/xelatex/hanzibox/hanzibox.pdf
index de80686c06b..d6711355a76 100644
--- a/Master/texmf-dist/doc/xelatex/hanzibox/hanzibox.pdf
+++ b/Master/texmf-dist/doc/xelatex/hanzibox/hanzibox.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/xelatex/hanzibox/hanzibox.dtx b/Master/texmf-dist/source/xelatex/hanzibox/hanzibox.dtx
index c499c05c8d0..3a05212a3b9 100644
--- a/Master/texmf-dist/source/xelatex/hanzibox/hanzibox.dtx
+++ b/Master/texmf-dist/source/xelatex/hanzibox/hanzibox.dtx
@@ -4,7 +4,6 @@
\iffalse
%</internal>
%<*readme>
-hanzibox
Boxed Chinese characters with Pinyin above and translation below based LaTeX3
=======
@@ -27,12 +26,15 @@ You can read the manual (in Chinese) for more details and examples.
Contributing
------------
-1. Gitee repository: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
-2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls).
+1. github repository:
+ 1. repository: [hanzibox-l3](https://github.com/registor/hanzibox-l3)
+ 2. Issues and pull requests are welcome. [issue](https://github.com/registor/hanzibox-l3/issues) or [pull request](https://github.com/registor/hanzibox-l3/pulls).
-=======
-hanzibox
-基于LaTeX3的汉字练习宏包
+2. gitee repository:
+ 1. repository: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
+ 2. Issues and pull requests are welcome. [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls).
+
+基于LaTeX3的带注音和译文的汉字练习宏包
=======
`hanzibox`是一个用LaTeX3开发的LaTeX宏包,它提供了`\hanzibox`和`\hanzidialog` 两个命令。这两个命令分别用于排版汉字学习中带有或不带田字格、米字格等背景格子的汉字,并可以根据需要在汉字正上方显示拼音,在正下方显示译文。其中,`\hanzibox`命令能够根据汉字自动调用`xpinyin`宏包的`\xpinyin*`命令实现汉字注音。并且`\hanzibox`命令提供了`\hanzibox*`星号版本,其注音功能是通过自动调用`xpinyin`宏包的`\pinyin`命令实现的。`\hanzidialog`命令的注音功能是通过在拼音选项中手动插入`xpinyin`宏包`\pinyin`命令实现的。
@@ -47,10 +49,14 @@ hanzibox
### 参与贡献
---------------------
-1. 本项目由西北农林科技大学信息工程学院耿楠创建和维护
-2. 如果您愿意一同参与工作(不计报酬,免费自由),请及时与作者联系
-3. 项目的gitee仓库地址:[hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
-4. 如果您有任何改进意见或者功能需求,欢迎提交 [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) 或 [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls)。
+
+1. github仓库:
+ (1). 仓库地址: [hanzibox-l3](https://github.com/registor/hanzibox-l3)
+ (2). Issues和PR: [issue](https://github.com/registor/hanzibox-l3/issues) or [pull request](https://github.com/registor/hanzibox-l3/pulls).
+
+2. gitee仓库:
+ (1). 仓库地址: [hanzibox-l3](https://gitee.com/nwafu_nan/hanzibox-l3)
+ (2). Issues and PR: [issue](https://gitee.com/nwafu_nan/hanzibox-l3/issues) or [pull request](https://gitee.com/nwafu_nan/hanzibox-l3/pulls).
Copyright and Licence
---------------------
@@ -154,7 +160,7 @@ Copyright and Licence
%</internal>
%<package>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
%<package>\RequirePackage{expl3}
-%<+package>\GetIdInfo$Id: hanzibox.dtx 2.1.1 2021-10-07 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
+%<+package>\GetIdInfo$Id: hanzibox.dtx 2.2.0 2021-10-11 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
%<package> {Boxed Chinese characters with Pinyin above and translation below.}
%<package>\ProvidesExplPackage{\ExplFileName}
%<package> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -173,7 +179,7 @@ Copyright and Licence
{\texttt{#1\breakablethinspace=\breakablethinspace#2}}
\def\breakablethinspace{\hskip 0.16667em\relax}
\begin{document}
- \DisableImplementation
+%<!--CODEDOC--> \DisableImplementation
\EnableImplementation
\DocInput{\jobname.dtx}
\IndexLayout
@@ -187,7 +193,7 @@ Copyright and Licence
% \changes{v2.0.0}{2021/09/25}{基于l3draw重新设计}
% \changes{v2.0.0}{2021/09/28}{重新编写README.md内容}
%
-% \CheckSum{1085}
+% \CheckSum{1222}
% \GetFileId{hanzibox.sty}
%
% \CharacterTable
@@ -209,10 +215,11 @@ Copyright and Licence
%
% \title{\bfseries\pkg{hanzibox}:田字格-米字格汉字练习宏包}
% \author{耿楠\\ \path{nangeng@nwafu.edu.cn}}
-% \date{\filedate\qquad\fileversion\thanks{\url{https://gitee.com/nwafu_nan/hanzibox-l3}.}}
+% \date{\filedate\qquad\fileversion\thanks{\url{https://github.com/registor/hanzibox-l3}}\thanks{\url{https://gitee.com/nwafu_nan/hanzibox-l3}}}
% \maketitle
%
% \changes{v2.0.0}{2021/09/28}{修订说明文档}
+% \changes{v2.1.2}{2021/10/07}{为说明文档添加目录}
%
% \begin{documentation}
%
@@ -221,13 +228,15 @@ Copyright and Licence
% \pkg{hanzibox} 是一个用\LaTeX3开发的 \LaTeX 宏包,它提供了\tn{hanzibox}和\tn{hanzidialog}
% 两个命令。这两个命令用于输出汉字学习中带有或不带田字格、米字格等背景格子的汉字,
% 并可以根据需要在汉字正上方显示拼音,在正下方显示译文。
-% 其中,\tn{hanzibox}命令能够根据汉字利用\pkg{xpinyin}宏包实现汉字注音。
-% 同时,\tn{hanzibox}命令还提供了\tn{hanzibox*}星号版本,以实现手动注音功能。
+% 其中,\tn{hanzibox}命令能够根据汉字利用\pkg{xpinyin}宏包自动实现汉字注音。
+% 同时,\tn{hanzibox}命令还提供了\tn{hanzibox*}星号版本,以实现汉字的手动注音功能。
% \tn{hanzidialog}命令的注音功能则是通过在其拼音选项中手动插入
% \pkg{xpinyin}宏包的\tn{pinyin}命令实现。
%
% \end{abstract}
%
+% \tableofcontents
+%
% \section{简要说明}
%
% \pkg{hanzibox} 是一个用于输出汉字学习中的田字格、米字格等背景,并在汉字正上方显示拼音,
@@ -240,7 +249,9 @@ Copyright and Licence
%
% \section{用户接口}
%
-% \begin{function}[added=2021-09-18,updated=2021-09-30]{\hanzibox,\hanzibox*}
+% \subsection{\tn{hanzibox}命令}
+%
+% \begin{function}[added=2021-09-18,updated=2021-10-07]{\hanzibox,\hanzibox*}
% \begin{syntax}
% \tn{hanzibox} \oarg{外观选项} \Arg{汉字} \oarg{拼音选项} \oarg{译文选项}
% \tn{hanzibox*} \oarg{外观选项} \Arg{汉字} \oarg{拼音选项} \oarg{译文选项}
@@ -251,45 +262,47 @@ Copyright and Licence
% \oarg{译文选项}可以是任意文本,需要注意的是,当需要\oarg{译文选项}时,
% \oarg{拼音选项}可以留空,但不能省略。
% 注音由\pkg{xpinyin}宏包自动根据汉字获得,此时,可能会存在多音字等问题,
-% 其调整详情请参阅\pkg{xpinyin}宏包说明。星号命令\tn{hanzibox*}用于手动排版拼音。
+% 其调整详情请参阅\pkg{xpinyin}宏包说明。星号命令\tn{hanzibox*}用于手动添加注音。
%
% 排版样式可通过\tn{hanziboxset}命令或\tn{hanzibox}\oarg{外观选项}的key-value进行设置。
%
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.40\linewidth,gobble=5]
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
% \centering
% \hanziboxset{fillcolor=yellow!30, charcolor=red,
% xscale=1.5,yscale=1.5,resize=real,framecolor=red}
-% \hanzibox[frametype=none]{我}
-% \hanzibox[frametype=口 ]{我}[][吾]
+% \hanzibox[frametype=none]{我}\\[1ex]
% \hanzibox[frametype=十 ]{我}[wo3][俺]
% \hanzibox[frametype=× ]{我}[wo2][爷]
-% \hanzibox[frametype=田 ]{我}[wo1][愚]
-% \hanzibox[frametype=米 ]{我}[ni3][奴]
-% \hanzibox[frametype=咪 ]{我}[ta1][山人]
+% \hanzibox[frametype=米 ]{我}[ni3][奴]\\[1ex]
+% \hanzibox[frametype=口,pinyinline=true]{我}[][吾]
+% \hanzibox[frametype=田,pinyinline=true]{我}[wo1][愚]
+% \hanzibox[frametype=咪,pinyinline=true]{我}[ta1][山人]
% \end{SideBySideExample}
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.40\linewidth,gobble=5]
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
% \centering
% \hanziboxset{xscale=1.5,yscale=1.5,resize=real}
-% \hanzibox*[frametype=none]{我}[wo3][me]
-% \hanzibox*[frametype=口 ]{我}[wo3][吾]
+% \hanzibox*[frametype=none]{我}[wo3][me]\\[1ex]
% \hanzibox*[frametype=十 ]{我}[wo3][俺]
% \hanzibox*[frametype=× ]{我}[wo3][爷]
-% \hanzibox*[frametype=田 ]{我}[wo2][愚]
-% \hanzibox*[frametype=米 ]{我}[ni3][奴]
-% \hanzibox*[frametype=咪 ]{我}[ta5][山人]
+% \hanzibox*[frametype=米 ]{我}[ni3][奴]\\[1ex]
+% \hanzibox*[frametype=口,pinyinline=true]{我}[wo3][吾]
+% \hanzibox*[frametype=田,pinyinline=true]{我}[wo2][愚]
+% \hanzibox*[frametype=咪,pinyinline=true]{我}[ta5][山人]
% \end{SideBySideExample}
% \end{function}
%
-% \begin{function}[added=2021-09-18,updated=2021-09-28]{\hanzidialog}
+% \subsection{\tn{hanzidialog}命令}
+%
+% \begin{function}[added=2021-09-18,updated=2021-10-07]{\hanzidialog}
% \begin{syntax}
% \tn{hanzidialog} \oarg{外观选项} \Arg{汉字} \oarg{拼音选项} \oarg{译文选项}
% \end{syntax}
% 排版汉字,并根据选项内容在顶部排版拼音,在底部排版译文。\\
% 其中,\Arg{汉字}可以留空,\oarg{拼音选项}可以是任意文本;\oarg{译文选项}可以是任意文本。
% \oarg{拼音选项}和\oarg{译文选项}都可以留空,也可以省略,
-% 但当需要\oarg{译文选项}时,\oarg{拼音选项}可以留空,不能省略。
-% 如果是汉语拼音则需要手动使用\pkg{xpinyin}宏包的\tn{pinyin}命令,
-% 排版样式可能通过\tn{hanziboxset}命令或\tn{hanzidialog}\oarg{外观选项}的key-value进行设置。
+% 但当需要\oarg{译文选项}时,\oarg{拼音选项}可以留空,但不能省略。
+% 如果是汉语拼音则需要手动使用\pkg{xpinyin}宏包的\tn{pinyin}命令添加注音,
+% 排版样式可通过\tn{hanziboxset}命令或\tn{hanzidialog}\oarg{外观选项}设置。
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=5]
% \centering
% \hanzidialog{王老师}[Wang \pinyin{lao3shi1}][teacher wang]
@@ -297,20 +310,22 @@ Copyright and Licence
% \hanzidialog[frametype=田]{王老师}[Wang \pinyin{lao3shi1}]
% [王先生]
%
-% \hanzidialog[height=1cm,frametype=咪,framecolor=red,resize=real]
+% \hanzidialog[frametype=咪,framecolor=red,pinyinline=true,
+% height=1cm,resize=real,pinyincolor=blue]
% {王老师}[Wang \pinyin{lao3shi1}][王先生]
-%
% \end{SideBySideExample}
% \end{function}
%
+% \subsection{\tn{hanziboxset}命令}
+%
% \begin{function}[added=2021-09-20,updated=2021-09-24]{\hanziboxset}
% \begin{syntax}
% \tn{hanziboxset} \marg{键值列表}
% \end{syntax}
% \tn{hanziboxset} 的参数是一组由(英文)逗号隔开的选项列表,
% 列表中的选项通常是 \kvopt{\meta{key}}{\meta{value}} 形式。
-% 部分选项的\meta{value} 可以省略。对于同一项,后续设置会覆盖以前的设置。
-% 在下文的说明中,多数选项都设有默认值。
+% 部分选项的\meta{value} 可以省略。对于同一选项,后续设置会覆盖以前的设置。
+% 多数选项都设有默认值。
%
% \tn{hanziboxset} 采用 \LaTeX3 风格的键值设置,支持不同类型以及多种
% 层次的选项设定。键值列表中,“|=|”左右的空格不影响设置;但需注意,
@@ -322,50 +337,65 @@ Copyright and Licence
% \section{选项说明}
%
% 本宏包提供了一系列选项,以实现汉字盒子外观样式设置。
-% 载入\pkg{hanzibox}宏包后,以下选项均可通过统一命令\tn{hanziboxset}进行设置。
+% 载入\pkg{hanzibox}宏包后,以下选项均可通过用户接口命令\tn{hanziboxset}进行设置。
% 同时,这些选项也可以通过\tn{hanzibox}或\tn{hanzidialog}命令的\oarg{外观选项}进行设置。
%
+% \subsection{基础字符和字号}
+%
% \begin{function}[added=2021-09-24,updated=2021-09-24]{basechar,zihao}
% \begin{syntax}
% basechar = \meta{CJK char} \init{好}
% zihao = \meta{字号} \init{4}
% \end{syntax}
-% \opt{basechar} 设置基字符,用于计算缩放比例,
+% \opt{basechar} 设置基字符,用于计算缩放比例及留空汉字占位处理,
% 基字符不同时,即使给定相同的缩放比例,其实际缩放比例也可能不同。
-%
-% \opt{zihao} 设置计算缩放比例时字号大小。
+%
+% \opt{zihao} 设置基字符的字号。
% \end{function}
%
-% \begin{function}[added=2021-09-27,updated=2021-09-28]{pinyinf,charf,tranf}
+% \subsection{拼音、汉字和译文格式}
+%
+% \begin{function}[added=2021-09-27,updated=2021-10-08]{pinyinf,charf,tranf}
% \begin{syntax}
% pinyinf = \meta{格式命令} \init{\normalsize}
% charf = \meta{格式命令} \init{\tiny}
% tranf = \meta{格式命令} \init{\tiny}
% \end{syntax}
-% 分别用于设置拼音、汉字、译文的排版格式。
+% 分别用于设置拼音、汉字、译文的排版格式,主要用于设置字体、字号、粗细等格式。
+%
+% 为了分解拼音,本宏包截获了原\pkg{xpinyin}宏包中的拼音输出,因此若需要修改拼音字体,
+% 请在\verb!pinyinf!选项中进行设置。
+%
+% \textcolor[HTML]{AD1457}{强烈建议将单个汉字宽度设置为大于其拼音或译文总宽度,
+% 以免在汉字间形成缝隙}。
% \end{function}
%
-% \begin{function}[added=2021-09-24,updated=2021-09-24]{frametype,resize}
+% \subsection{外框类型和缩放方式}
+%
+% \begin{function}[added=2021-09-24,updated=2021-10-08]{frametype,resize}
% \begin{syntax}
-% frametype = <none|口|十|田|米|咪> \init{none}
+% frametype = <none|十|×|米|口|田|咪> \init{none}
% resize = <none|real|base> \init{none}
% \end{syntax}
-% \opt{frametype} 设置汉字盒子样式。可用值的效果与选项值文字形状类似:\verb|口|--仅方框,
-% \verb|十|--仅中间的横线和竖线,\verb|田|--常见的田字格,\verb|米|--十字格再加上斜的两条对角线,
-% \verb|咪|--常见的米字格。
+% \opt{frametype} 设置汉字盒子样式。可用值的效果与选项值文字形状类似:
+% \verb|十|--仅中间的横线和竖线,\verb|×|--仅中间的两条对角线,
+% \verb|米|--十字格再加上斜的两条对角线,
+% \verb|口|--仅方框,\verb|田|--常见的田字格,\verb|咪|--常见的米字格。
+% \end{function}
%
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=5]
% \centering
-% \hanzibox[frametype=none]{无}
-% \hanzibox[frametype=口 ]{口}
+% \hanzibox[frametype=none]{无}\\[1ex]
% \hanzibox[frametype=十 ]{十}
+% \hanzibox[frametype=× ]{义}
+% \hanzibox[frametype=米 ]{米}\\[1ex]
+% \hanzibox[frametype=口 ]{口}
% \hanzibox[frametype=田 ]{田}
-% \hanzibox[frametype=米 ]{米}
% \hanzibox[frametype=咪 ]{咪}
% \end{SideBySideExample}
%
% \opt{resize} 设置缩放方式,\opt{real}--使用字符实际宽高缩放,
-% \opt{base}--使用 \opt{basechar} 设置的字符的宽高缩放,
+% \opt{base}--使用 \opt{basechar} 字符的宽高缩放,
%
% 以下为宽度设置为 1cm 时的缩放情况。
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=5]
@@ -376,7 +406,8 @@ Copyright and Licence
% \hanzibox[resize=real ]{实}
% \hanzibox[resize=base ]{基}
% \end{SideBySideExample}
-% \end{function}
+%
+% \subsection{缩放比例及尺寸}
%
% \begin{function}[added=2021-09-24,updated=2021-09-24]{
% xscale,yscale,scale,
@@ -392,77 +423,124 @@ Copyright and Licence
%
% 宽高具有更高的优先级,即若比例和宽高都设置了,则使用宽高来计算。
% 宽高都为0cm视为未设置,二者有一大于0cm,视为设置了宽高。
-%
-% 此处的宽高和最终的宽高可能略有差异,最终的宽高保存在
-% \tn{hanziboxwidth} 和 \tn{hanziboxheight} dim寄存器中。
% \end{function}
%
+% \subsection{盒子样式}
+%
% \begin{function}[added=2021-09-24,updated=2021-09-24]{
% linewidth,
% dashpattern,
% framearc,
-% framearc*
+% framearc*,
+% framelinewidth,
+% pinyinlinewidth,
+% crosslinewidth
% }
% \begin{syntax}
-% linewidth = \meta{dim} \init{0.4pt}
-% dashpattern = \meta{ dim1, dim2, ... }
-% framearc = \meta{dim}
-% framearc* = \{ \marg{dim1} \marg{dim2} \}
+% linewidth = \meta{dim} \init{0.4pt}
+% dashpattern = \meta{ dim1, dim2, ... }
+% framearc = \meta{dim}
+% framearc* = \{ \marg{dim1} \marg{dim2} \}
+% framelinewidth = \meta{dim} \init{0.4pt}
+% pinyinlinewidth = \meta{dim} \init{0.4pt}
+% crosslinewidth = \meta{dim} \init{0.4pt}
% \end{syntax}
-% 设置边框线宽、线型、转角样式。
+% 设置边框线宽、线型、转角样式及拼音四线格和内格线线宽。
%
+% \textcolor[HTML]{AD1457}{注:目前\textbf{linewidth}与
+% \textbf{framelinewidth}选项的作用相同,都是设置边框线宽,
+% 在下一个版本中,会删除\textbf{linewidth}选项}。
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.28\linewidth,gobble=5]
% \centering
% \hanziboxset{width=1.0cm,resize=real,framecolor=red}
% \hanzibox[linewidth=1pt,frametype=口]{好}
% \hanzibox[dashpattern={1.5mm,1mm,2mm,1.5mm},frametype=田]{好}
-% \hanzibox[framearc=1mm,frametype=口]{好} \\
-% \hanzibox[framearc=1mm,frametype=咪]{好}
-% \hanzibox[framearc*={1mm}{2mm},frametype=口]{好}
-% \hanzibox[framearc*={2mm}{1mm},frametype=咪]{好}
+% \hanzibox[framelinewidth=1pt,frametype=咪]{好} \\
+% \hanzibox[pinyinline,framearc=1mm,frametype=口]{好}
+% \hanzibox[framearc*={1mm}{2mm},frametype=田]{好}
+% \hanzibox[framearc*={2mm}{1mm},frametype=咪]{好}\\
+% \hanzibox[pinyinline,pinyinlinewidth=0.8pt,frametype=口]{好}
+% \hanzibox[crosslinewidth=1pt,frametype=田]{好}
+% \hanzibox[crosslinewidth=1pt,frametype=咪]{好}
% \end{SideBySideExample}
% \end{function}
%
-% \begin{function}[added=2021-09-24,updated=2021-09-24]{
+% \subsection{颜色设置}
+%
+%
+% \begin{function}[added=2021-10-07,updated=2021-10-07]{crosscolorratio}
+% \begin{syntax}
+% crosscolorratio = \meta{integer} \init{20}
+% \end{syntax}
+% 格子内部十字线或米字线颜色占边框颜色的比例(0$\sim$100\%)。
+%
+% \textcolor[HTML]{AD1457}{注:\textbf{crosscolorratio}选项须在设置了\textbf{framecolor}选项后才能生效}。
+%
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=5]
+% \centering
+% \hanzibox[frametype=咪,framecolor=red]{十}
+% \hanzibox[frametype=咪,crosscolorratio=30,framecolor=red]{田}
+% \hanzibox[frametype=咪,crosscolorratio=50,framecolor=red]{米}
+% \hanzibox[frametype=咪,crosscolorratio=80,framecolor=red]{咪}
+% \end{SideBySideExample}
+% \end{function}
+%
+% \begin{function}[added=2021-09-24,updated=2021-10-07]{
% framecolor,
% framecolor*,
% charcolor,
% charcolor*,
+% pinyincolor,
+% pinyincolor*,
+% trancolor,
+% trancolor*,
% fillcolor,
% fillcolor*
% }
% \begin{syntax}
-% framecolor = \meta{color expr} \init{black}
-% framecolor* = \meta{model(s)} \meta{value(s)}
-% charcolor = \meta{color expr} \init{black}
-% charcolor* = \meta{model(s)} \meta{value(s)}
-% fillcolor = \meta{color expr}
-% fillcolor* = \meta{model(s)} \meta{value(s)}
+% framecolor = \meta{color expr} \init{black}
+% framecolor* = \meta{model(s)} \meta{value(s)}
+% charcolor = \meta{color expr} \init{black}
+% charcolor* = \meta{model(s)} \meta{value(s)}
+% pinyincolor = \meta{color expr} \init{black}
+% pinyincolor* = \meta{model(s)} \meta{value(s)}
+% trancolor = \meta{color expr} \init{black}
+% trancolor* = \meta{model(s)} \meta{value(s)}
+% fillcolor = \meta{color expr}
+% fillcolor* = \meta{model(s)} \meta{value(s)}
% \end{syntax}
-% 分别设置格子线条、字符和填充颜色。
+% 分别设置格子外框、字符、拼音、译文和填充颜色。
% 颜色名称仅支持 \LaTeX3 定义的 black, white, red, green, blue, cyan, magenta 和 yellow。
% 颜色模型和表达式也应使用 \LaTeX3 支持的模型和表达式,详见 \pkg{interface3.pdf} 文档。
%
% 若要去掉 \opt{fillcolor},应将其置为空(\verb|fillcolor={}|),而不是将其设置为white(白色)。
% \end{function}
%
-% \begin{function}[added=2021-10-07,updated=2021-10-07]{crosscolorratio}
+% \subsection{字符轮廓类型}
+%
+% \begin{function}[added=2021-10-08,updated=2021-10-08]{charstroke}
% \begin{syntax}
-% crosscolorratio = \meta{integer} \init{20}
+% charstroke = <none|solid|dashed|invisible> \init{none}
% \end{syntax}
-% 格子内部十字线或米字线颜色占边框颜色的比例。
+% 设置字符外轮廓样式。
%
-% \textcolor[HTML]{AD1457}{注:\textsf{crosscolorratio}选项须在使用\textsf{framecolor}后起效}。
+% 初始值 \opt{none} 按原样输出。\opt{solid} 设置外轮廓为 0.10bp 的实线,
+% \opt{dashed} 设置外轮廓为 0.10bp 的虚线。同时,不填充轮廓内部,显示为背景颜色。
+% \opt{invisible} 将字符设置为不可见,但不影响背景和网格的显示,隐藏的字仍然可被复制。
%
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=5]
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.30\linewidth,gobble=5]
% \centering
-% \hanzibox[frametype=咪,framecolor=red]{十}
-% \hanzibox[frametype=咪,crosscolorratio=30,framecolor=red]{田}
-% \hanzibox[frametype=咪,crosscolorratio=50,framecolor=red]{米}
-% \hanzibox[frametype=咪,crosscolorratio=80,framecolor=red]{咪}
+% \hanziboxset{width=1.0cm,resize=real,frametype=咪,
+% framecolor=red}
+% \hanzibox[charstroke=none ]{我}
+% \hanzibox[charstroke=solid,charcolor=red ]{我}\\
+% \hanzibox[charstroke=dashed,charcolor=green!40!black]{我}
+% \hanzibox[charstroke=invisible ]{我}
% \end{SideBySideExample}
% \end{function}
%
+% \subsection{声母、韵母和声调开关}
+%
% \begin{function}[added=2021-09-24,updated=2021-09-24]{initial,vowel,tone}
% \begin{syntax}
% initial = <\TTF> \init{true}
@@ -470,8 +548,10 @@ Copyright and Licence
% tone = <\TTF> \init{true}
% \end{syntax}
% 分别用于设置是否输出拼音的声母、韵母和声调,默认值为\textbf{true}。
-% 该选项仅对\tn{hanzibox}命令有效。
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.33\linewidth,gobble=5]
+%
+% 该选项对\tn{hanzidialog}命令无效。
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.28\linewidth,gobble=5]
+%
% \centering
% \hanziboxset{frametype=咪,framecolor=red,
% fillcolor=yellow!40,resize=real}
@@ -485,22 +565,44 @@ Copyright and Licence
% [How long will the full moon appear?]\\[0.5ex]
% \hanzibox[initial=false,vowel=false]{明有几时有}
% [][How long will the full moon appear?]
+%
% \end{SideBySideExample}
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.28\linewidth,gobble=5]
% \centering
% \hanziboxset{frametype=咪,framecolor=red,fillcolor=yellow!40,
-% charf=\Huge,resize=real}
-% \hanzibox*[initial=false]{我}[wo3][吾]
-% \hanzibox*[initial=true,vowel=false]{我}[wo3][吾]
-% \hanzibox*[initial=true,vowel=true,tone=false]{我}[wo3][不才]
+% charf=\Huge,pinyinf=\small,tranf=\small,resize=real}
+% \hanzibox*[tone=false]{我}[wo3][吾]
+% \hanzibox*[vowel=false]{我}[wo3][吾]
+% \hanzibox*[initial=false]{我}[wo3][不才]
% \end{SideBySideExample}
% \end{function}
%
+% \subsection{拼音四线格开关}
+%
+% \begin{function}[added=2021-10-07,updated=2021-10-08]{pinyinline}
+% \begin{syntax}
+% pinyinline = <\TFF> \init{false}
+% \end{syntax}
+% 用于设置是否输出拼音四线格,默认值为\textbf{false}。
+% 为保持拼音对齐一致性,\verb!pinyinline=false!时,
+% 仅不输出拼音四线格,但拼音四线格的空间占位仍然存在。
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.33\linewidth,gobble=5]
+% \centering
+% \hanziboxset{frametype=咪,framecolor=red,charf=\large,
+% fillcolor=yellow!40}
+% \hanzibox[pinyinline=false]{明月几时有}[]
+% [How long will the full moon appear?]\\[0.5ex]
+% \hanzibox[pinyinline=true]{明月几时有}[]
+% \end{SideBySideExample}
+% \end{function}
+%
+% \subsection{拼音、汉字和译文开关}
+%
% \begin{function}[added=2021-09-21,updated=2021-09-26]{pinyin,hanzi,tran}
% \begin{syntax}
% pinyin = <\TTF> \init{true}
-% hanzi = <\TTF> \init{true}
-% tran = <\TTF> \init{true}
+% hanzi = <\TTF> \init{true}
+% tran = <\TTF> \init{true}
% \end{syntax}
% 分别用于设置是否输出拼音、汉字和译文,默认值为\textbf{true}。
% 该选项对\tn{hanzidialog}命令无效。
@@ -518,28 +620,35 @@ Copyright and Licence
% \end{function}
%
% \changes{v2.0.0}{2021/09/28}{在说明文档中添加应用实例}
+% \changes{v2.2.0}{2021/10/07}{为部分实例添加拼音四线格}
%
% \section{应用实例}
%
% \pkg{hanzibox}宏包可以广泛用于汉字学习的练习中。
%
% \subsection{拼一拼---写一写练习}
+% 利用各种选项的有效组合,可以实现汉字拼一拼---写一写练习。
%
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=5]
+% \textcolor[HTML]{AD1457}{注意:\tn{hspace*}命令中的
+% 参数\textbf{0.4pt}是边框线条宽度,请根据实际情况调整}。
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.32\linewidth,gobble=5]
% \centering
-% \hanziboxset{frametype=田,framecolor=blue}
-% \hanzibox{门}\hanzibox[hanzi=false]{口}\hfill
-% \hanzibox{生}\hanzibox[hanzi=false]{日}\hfill
-% \hanzibox{题}\hanzibox[hanzi=false]{目}\hfill
-% \hanzibox[hanzi=false]{田}\hanzibox{野}
+% \hanziboxset{frametype=田,framecolor=blue,
+% charf=\Huge,pinyinf=\small}
+% \hanzibox{门}\hspace*{-0.4pt}\hanzibox[hanzi=false]{口}
+% \hfill
+% \hanzibox{生}\hspace*{-0.4pt}\hanzibox[hanzi=false]{日}\\
+% \hanzibox{题}\hspace*{-0.4pt}\hanzibox[hanzi=false]{目}
+% \hfill
+% \hanzibox[hanzi=false]{田}\hspace*{-0.4pt}\hanzibox{野}
% \end{SideBySideExample}
%
% \subsection{标注声母练习}
%
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.32\linewidth,gobble=5]
% \centering
% \hanziboxset{frametype=咪,framecolor=red,charcolor=red,
-% charf=\Huge,pinyinf=\small,initial=false}
+% pinyinline=true,charf=\Huge,pinyinf=\small,initial=false}
% \hanzibox{门口}\hfill
% \hanzibox{生日}\\
% \hanzibox{题目}\hfill
@@ -548,10 +657,10 @@ Copyright and Licence
%
% \subsection{标注韵母练习}
%
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.32\linewidth,gobble=5]
% \centering
% \hanziboxset{frametype=咪,framecolor=red,charcolor=red,
-% charf=\Huge,pinyinf=\small,vowel=false}
+% pinyinline=true,charf=\Huge,pinyinf=\small,vowel=false}
% \hanzibox{门口}\hfill
% \hanzibox{生日}\\
% \hanzibox{题目}\hfill
@@ -560,10 +669,10 @@ Copyright and Licence
%
% \subsection{标注声调练习}
%
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.35\linewidth,gobble=5]
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.32\linewidth,gobble=5]
% \centering
% \hanziboxset{frametype=咪,framecolor=red,charcolor=red,
-% charf=\Huge,pinyinf=\small,tone=false}
+% pinyinline=true,charf=\Huge,pinyinf=\small,tone=false}
% \hanzibox{门口}\hfill
% \hanzibox{生日}\\
% \hanzibox{题目}\hfill
@@ -640,17 +749,19 @@ Copyright and Licence
%
% \changes{v2.1.1}{2021/10/07}{在格子纸示例中用coffin实现每行格子以提升编译速度}
%
-% \subsection{生成汉字书写练习格子纸}
+% \subsection{生成汉字书写格子纸}
%
-% 可以通过将\tn{hanzibox}命令的\Arg{汉字}参数留空,
+% 可以通过将\tn{hanzibox}命令的\Arg{汉字}参数留空,并设置\verb!tran=false!,
% 或将\tn{hanzibox}、\tn{hanzibox*}命令的\verb!hanzi!选项置为
% \verb!false!(\verb!hanzi=false!),从而生成空白背景格子,
% 再根据需要通过循环的方式生成指定行数和列数的
% 汉字书写练习用格子纸。
%
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.43\linewidth,gobble=5]
+% \textcolor[HTML]{AD1457}{注意:参数中的\textbf{0.4pt}是边框线条宽度,
+% 请根据实际情况调整}。
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.37\linewidth,gobble=5]
% \hanziboxset{frametype=咪,framecolor=red,
-% charcolor=red,charf=\huge}
+% tran=false,charcolor=red,charf=\huge}
% \centering
% \ExplSyntaxOn
% \hcoffin_set:Nn \l_tmpa_coffin
@@ -658,21 +769,24 @@ Copyright and Licence
% \int_step_inline:nn {6}
% {
% \hanzibox{}
-% \hspace*{-0.35pt}
+% \hspace*{-0.40pt}
% }
% }
+% \hcoffin_set:Nn \l_tmpb_coffin
+% {}
% \int_step_inline:nn {8}
% {
-% \coffin_typeset:Nnnnn
-% \l_tmpa_coffin { l } { b } { 0pt } { 0pt }
-% \par\nointerlineskip\vspace*{-3.3pt}
-% }
+% \coffin_join:NnnNnnnn \l_tmpb_coffin { hc } { b }
+% \l_tmpa_coffin { hc } { t } { 0pt } { 0.4pt }
+% }
+% \coffin_typeset:Nnnnn
+% \l_tmpb_coffin { l } { b } { 0pt } { 0pt }
% \ExplSyntaxOff
% \end{SideBySideExample}
%
-% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.43\linewidth,gobble=5]
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.37\linewidth,gobble=5]
% \hanziboxset{frametype=咪,framecolor=red,
-% charcolor=red,charf=\huge,hanzi=false}
+% pinyinline=true,charf=\huge,hanzi=false}
% \centering
% \ExplSyntaxOn
% \hcoffin_set:Nn \l_tmpa_coffin
@@ -680,14 +794,14 @@ Copyright and Licence
% \int_step_inline:nn {6}
% {
% \hanzibox*{国}
-% \hspace*{-0.35pt}
+% \hspace*{-0.40pt}
% }
% }
% \int_step_inline:nn {8}
% {
% \coffin_typeset:Nnnnn
% \l_tmpa_coffin { l } { b } { 0pt } { 0pt }
-% \par\nointerlineskip\vspace*{-6.30pt}
+% \par\nointerlineskip
% }
% \ExplSyntaxOff
% \end{SideBySideExample}
@@ -703,7 +817,9 @@ Copyright and Licence
% \setpinyin{尽}{jin4}
% \hanziboxset{frametype=咪,framecolor=red,
% charf=\huge,pinyinf=\footnotesize,
-% charcolor=green!40!black}
+% charcolor=green!40!black,
+% pinyincolor=green!40!black,
+% trancolor=green!40!black}
% \centering
% \hanzibox{故人西辞黄鹤楼}
% \hanzibox{烟花三月下扬州}
@@ -719,7 +835,8 @@ Copyright and Licence
%
% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.33\linewidth,gobble=5]
% \hanziboxset{frametype=咪,framecolor=red,charf=\Large,
-% charcolor=green!40!black,}
+% pinyinline=true,charcolor=green!40!black,
+% pinyincolor=red!20!black,trancolor=blue!40!black}
% \centering
% \hanzibox*{故人西辞黄鹤楼}[gu4ren2xi1ci2huang2he2lou2]
% \hanzibox*{烟花三月下扬州}[yan1hua1san1yue4]
@@ -727,6 +844,25 @@ Copyright and Licence
% \hanzibox*{}[wei2jian4chang2jiang1tian1ji4liu2]
% \end{SideBySideExample}
%
+% \subsection{生成描红练习}
+%
+% 合理的设置汉字的颜色浓淡或通过\verb!charstroke!选项设置
+% 汉字轮廓选项,可以生成用于描红练习的格子纸。
+%
+% 若设置\verb!charstroke=invisible!,则会使汉字隐藏不可见,
+% 但隐藏的汉字仍然可被复制。
+%
+% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.25\linewidth,gobble=5]
+% \hanziboxset{frametype=咪,framecolor=red,pinyinline=true,
+% pinyincolor=green!30!black,charf=\Large,pinyinf=\footnotesize}
+% \centering
+% \hanzibox[charcolor=red!30,pinyincolor=red]{讲普通话}
+% \hanzibox[charcolor=black!30,pinyinline=false]{写规范字}
+% \hanzibox[charcolor=red,charstroke=solid]{讲普通话}
+% \hanzibox[charcolor=black,charstroke=dashed]{写规范字}
+% \hanzibox[charcolor=red,charstroke=invisible]{讲普通话}
+% \end{SideBySideExample}
+%
% \end{documentation}
%
% \StopEventually{}
@@ -736,7 +872,7 @@ Copyright and Licence
% \section{代码实现}
%
% 本宏包使用 \LaTeX3 语法编写,依赖 \pkg{expl3} 环境,
-% 并需调用 \pkg{l3packages}、\pkg{l3draw}、\pkg{xpinyin}等相关宏包。
+% 并需调用 \pkg{l3packages}、\pkg{l3draw}、\pkg{xpinyin}等宏包。
%
% 按照 \LaTeX3 语法,代码中的空格、换行、回车与制表符会完全被忽略,
% 而下划线“|_|”和冒号“|:|”则可作为一般字母使用。
@@ -785,11 +921,11 @@ Copyright and Licence
%
% \end{macrocode}
%
-% \changes{v2.1.1}{2021/10/03}{修订盒子高度计算函数的expl3版本兼容问题}
+% \changes{v2.1.1}{2021/10/03}{解决盒子高度计算函数的expl3版本兼容问题}
%
% 判断\tn{box_ht_plus_dp:N}函数是否存在,若不存在,则定义该函数。
-% 为了解决expl3的旧版本兼容问题。
-% 摘录于\url{https://ask.latexstudio.net/ask/question/3773.html}。
+% 为了解决与expl3的旧版本兼容问题(
+% 摘录于\url{https://ask.latexstudio.net/ask/question/3773.html})。
%
% \begin{macrocode}
\cs_if_free:NT \box_ht_plus_dp:N
@@ -799,7 +935,7 @@ Copyright and Licence
}
% \end{macrocode}
%
-% 检查编译引擎
+% 检查编译引擎,目前仅支持xetex引擎。
%
% \begin{macrocode}
\sys_if_engine_xetex:F
@@ -828,10 +964,10 @@ Copyright and Licence
% \changes{v1.1.0}{2021/09/22}{为用户命令添加组限制}
% \changes{v2.0.0}{2021/09/26}{调整星号命令为手动拼音注音}
% 背景盒子由l3draw实现,
-% 其设计思路和部分源码来自\LaTeX 字帖宏包(\url{https://www.ctan.org/pkg/zitie})。
+% 其设计思路和部分源码来自\LaTeX 的\pkg{zitie}宏包(\url{https://www.ctan.org/pkg/zitie})。
%
% \begin{macro}{\hanzibox}
-% 自动拼音汉字盒子命令。
+% 自动注音汉字盒子命令。
% \begin{macrocode}
\NewDocumentCommand{\hanzibox}{ s O{} m O{} O{} }
{
@@ -850,7 +986,7 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{\hanzidialog}
-% 手动汉字盒子命令。
+% 手动注音汉字盒子命令。
% \begin{macrocode}
\NewDocumentCommand{\hanzidialog}{O{} m O{} O{} }
{
@@ -868,45 +1004,59 @@ Copyright and Licence
% \changes{v1.1.0}{2021/09/21}{添加缩放比例,前景/背景色,隐藏控制变量。}
% \changes{v2.0.0}{2021/09/24}{根据l3draw的需要重新设计各个变量。}
% \changes{v2.1.0}{2021/09/30}{添加记录拼音返回结果的clist变量。}
+% \changes{v2.2.0}{2021/10/07}{添加拼音线开关及拼音和译文颜色变量}
+% \changes{v2.2.0}{2021/10/08}{添加字符轮廓类型选择变量}
+% \changes{v2.2.0}{2021/10/09}{添加拼音汉字coffin变量}
%
% \begin{variable}{\l_@@_autopinyin_bool,
-% \l_@@_withinitial_bool,
-% \l_@@_withvowel_bool,
-% \l_@@_withtone_bool,
-% \l_@@_withpinyin_bool,
-% \l_@@_withhanzi_bool,
-% \l_@@_withtran_bool,
-% \l_@@_basebox_box,
-% \l_@@_frame_type_tl,
-% \g_@@_frame_list_clist,
-% \l_@@_resize_method_tl,
-% \g_@@_resize_method_clist,
-% \l_@@_frame_size_dim,
-% \l_@@_char_width_dim,
-% \l_@@_char_height_dim,
-% \l_@@_box_width_dim,
-% \l_@@_box_height_dim,
-% \l_@@_linewidth_dim,
-% \l_@@_box_coffin,
-% \l_@@_tmpa_coffin,
-% \l_@@_tmpb_coffin,
-% \hanziboxwidth,
-% \hanziboxheight,
-% \l_@@_pinyin_tl,
-% \l_@@_tone_pinyin_clist,
-% \l_@@_character_tl,
-% \l_@@_translation_tl,
-% \l_@@_pinyin_format_tl,
-% \l_@@_character_format_tl,
-% \l_@@_translation_format_tl,
-% \l_@@_cross_color_ratio_int,
-% \l_@@_pinyin_int,
-% \l_@@_character_int,
-% \l_@@_translation_int,
-% \l_@@_tone_int,
-% \l_@@_pinyin_str,
-% \l_@@_initial_tl,
-% \l_@@_vowel_tl
+% \l_@@_withinitial_bool,
+% \l_@@_withvowel_bool,
+% \l_@@_withtone_bool,
+% \l_@@_withpinyin_bool,
+% \l_@@_withpinyinlines_bool,
+% \l_@@_withhanzi_bool,
+% \l_@@_withtran_bool,
+% \l_@@_basebox_box,
+% \l_@@_frame_type_tl,
+% \g_@@_frame_list_clist,
+% \l_@@_resize_method_tl,
+% \g_@@_resize_method_clist,
+% \l_@@_frame_size_dim,
+% \l_@@_char_width_dim,
+% \l_@@_char_height_dim,
+% \l_@@_pinyin_height_i_dim,
+% \l_@@_pinyin_height_ii_dim,
+% \l_@@_pinyin_height_iii_dim,
+% \l_@@_box_width_dim,
+% \l_@@_box_height_dim,
+% \l_@@_frame_linewidth_dim,
+% \l_@@_pinyin_linewidth_dim,
+% \l_@@_cross_linewidth_dim,
+% \l_@@_tone_pinyin_clist,
+% \l_@@_str_box_coffin,
+% \l_@@_box_coffin,
+% \l_@@_pinyin_box_coffin,
+% \l_@@_tran_box_coffin,
+% \l_@@_pinyin_hanzi_coffin,
+% \l_@@_tmpa_coffin,
+% \l_@@_tmpb_coffin,
+% \hanziboxwidth,
+% \hanziboxheight,
+% \l_@@_pinyin_tl,
+% \l_@@_character_tl,
+% \l_@@_translation_tl,
+% \l_@@_pinyin_format_tl,
+% \l_@@_character_format_tl,
+% \l_@@_translation_format_tl,
+% \l_@@_cross_color_ratio_int,
+% \l_@@_pinyin_int,
+% \l_@@_character_int,
+% \l_@@_translation_int,
+% \l_@@_charstroke_type_int,
+% \l_@@_tone_int,
+% \l_@@_pinyin_str,
+% \l_@@_initial_tl,
+% \l_@@_vowel_tl,
% }
% 定义变量。
%
@@ -916,6 +1066,7 @@ Copyright and Licence
\bool_new:N \l_@@_withvowel_bool
\bool_new:N \l_@@_withtone_bool
\bool_new:N \l_@@_withpinyin_bool
+\bool_new:N \l_@@_withpinyinlines_bool
\bool_new:N \l_@@_withhanzi_bool
\bool_new:N \l_@@_withtran_bool
@@ -927,9 +1078,14 @@ Copyright and Licence
\dim_new:N \l_@@_frame_size_dim
\dim_new:N \l_@@_char_width_dim
\dim_new:N \l_@@_char_height_dim
+\dim_new:N \l_@@_pinyin_height_i_dim
+\dim_new:N \l_@@_pinyin_height_ii_dim
+\dim_new:N \l_@@_pinyin_height_iii_dim
\dim_new:N \l_@@_box_width_dim
\dim_new:N \l_@@_box_height_dim
-\dim_new:N \l_@@_linewidth_dim
+\dim_new:N \l_@@_frame_linewidth_dim
+\dim_new:N \l_@@_pinyin_linewidth_dim
+\dim_new:N \l_@@_cross_linewidth_dim
\clist_new:N \l_@@_tone_pinyin_clist
@@ -937,6 +1093,7 @@ Copyright and Licence
\coffin_new:N \l_@@_box_coffin
\coffin_new:N \l_@@_pinyin_box_coffin
\coffin_new:N \l_@@_tran_box_coffin
+\coffin_new:N \l_@@_pinyin_hanzi_coffin
\coffin_new:N \l_@@_tmpa_coffin
\coffin_new:N \l_@@_tmpb_coffin
@@ -953,6 +1110,7 @@ Copyright and Licence
\int_new:N \l_@@_pinyin_int
\int_new:N \l_@@_character_int
\int_new:N \l_@@_translation_int
+\int_new:N \l_@@_charstroke_type_int
\int_new:N \l_@@_tone_int
\str_new:N \l_@@_pinyin_str
@@ -967,13 +1125,43 @@ Copyright and Licence
% \subsubsection{设置填充色}
%
% \begin{macro}{\@@_aux_color_fill:}
-% 设置填充色
+% 设置空白填充色
% \begin{macrocode}
\cs_new_nopar:Nn \@@_aux_color_fill:
{ }
% \end{macrocode}
% \end{macro}
%
+% \changes{v2.2.0}{2021/10/07}{添加拼音高度计算函数}
+%
+% \subsubsection{计算拼音高度}
+%
+% \begin{macro}{\@@_calc_pinyin_h:}
+% 计算拼音线基础调试(通过字母"a"的高度计算)
+% \begin{macrocode}
+\cs_new:Npn \@@_calc_pinyin_h:
+ {
+ \hbox_set:Nn \l_tmpa_box
+ {
+ \tl_use:N \l_@@_pinyin_format_tl
+ a
+ }
+ \dim_set:Nn \l_@@_pinyin_height_i_dim
+ {
+ \box_ht:N \l_tmpa_box
+ }
+ \dim_set:Nn \l_@@_pinyin_height_ii_dim
+ {
+ \l_@@_pinyin_height_i_dim + \l_@@_pinyin_height_i_dim
+ }
+ \dim_set:Nn \l_@@_pinyin_height_iii_dim
+ {
+ \l_@@_pinyin_height_i_dim + \l_@@_pinyin_height_i_dim + \l_@@_pinyin_height_i_dim
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsubsection{计算盒子尺寸}
%
% \begin{macro}{\@@_calc_basechar_w_h:}
@@ -1003,7 +1191,7 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
-% \changes{v2.0.0}{2021/09/28}{添加根据基字符格式计算外观盒子尺寸的函数}
+% \changes{v2.0.0}{2021/09/28}{添加根据基字符格式计算盒子尺寸函数}
%
% \begin{macro}{\@@_calc_frame_size:}
% 计算外框长度(正方形,由基字符按charf选项设定的格式构造的盒子确定)
@@ -1033,7 +1221,7 @@ Copyright and Licence
\dim_gset_eq:NN \l_@@_frame_size_dim \l_tmpb_dim
}
- \dim_gadd:Nn \l_@@_frame_size_dim { 2pt }
+ \dim_gadd:Nn \l_@@_frame_size_dim { 1pt }
\dim_gset_eq:NN \hanziboxwidth \l_@@_frame_size_dim
\dim_gset_eq:NN \hanziboxheight \l_@@_frame_size_dim
@@ -1073,77 +1261,143 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
+% \changes{v2.2.0}{2021/10/07}{添加拼音四线格绘制函数}
+%
% \begin{macrocode}
-\@@_new_frame_construct:nn { 口 }
+\@@_new_frame_construct:nn { pinyinlines }
{
- \color_stroke:n { hanziboxframecolor }
- \draw_path_rectangle_corners:nn { #1, #2} { #3, #4}
-
- \cs_if_eq:NNTF \@@_aux_color_fill: \c_empty_tl
+ \bool_if:NTF \l_@@_withpinyinlines_bool
{
- \draw_path_use_clear:n { stroke }
+ \draw_scope_begin:
+ \draw_path_moveto:n { #1, 0 }
+ \draw_path_lineto:n { #3, 0 }
+ \draw_path_moveto:n { #1, \l_@@_pinyin_height_i_dim }
+ \draw_path_lineto:n { #3, \l_@@_pinyin_height_i_dim }
+ \draw_path_moveto:n { #1, \l_@@_pinyin_height_ii_dim }
+ \draw_path_lineto:n { #3, \l_@@_pinyin_height_ii_dim }
+ \draw_path_moveto:n { #1, \l_@@_pinyin_height_iii_dim }
+ \draw_path_lineto:n { #3, \l_@@_pinyin_height_iii_dim }
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
}
{
- \draw_path_use_clear:n { stroke , fill }
+ \draw_scope_begin:
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \tl_use:N \l_@@_pinyin_format_tl
+ \phantom{a}
+ }
+
+ \coffin_resize:Nnn \l_tmpa_coffin
+ { #3 } { \l_@@_pinyin_height_iii_dim }
+
+ \draw_coffin_use:Nnn \l_tmpa_coffin { l } { b }
+ \draw_scope_end:
}
}
% \end{macrocode}
%
-% \changes{v2.1.1}{2021/10/07}{用hanziboxcrosscolor设置内格子线颜色}
+% \changes{v2.1.2}{2021/10/07}{分离汉字外框与填充绘制函数}
%
% \begin{macrocode}
-\@@_new_frame_construct:nn { 十 }
+\@@_new_frame_construct:nn { filledbox }
{
- \tl_if_empty:NF \l_@@_dash_pattern_tl
+ \cs_if_eq:NNF \@@_aux_color_fill: \c_empty_tl
{
- \exp_args:No \draw_dash_pattern:nn { \l_@@_dash_pattern_tl } { 0pt }
+ \color_stroke:n { hanziboxframecolor }
+ \draw_path_rectangle_corners:nn { #1, #2} { #3, #4}
+
+ \draw_path_use_clear:n { stroke, fill }
}
- \color_stroke:n { hanziboxcrosscolor }
- \draw_path_moveto:n { (#3)/2, #2 }
- \draw_path_lineto:n { #3/2, #4 }
- \draw_path_moveto:n { #1, (#4)/2 }
- \draw_path_lineto:n { #3, (#4)/2 }
- \draw_path_use_clear:n { stroke }
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\@@_new_frame_construct:nn { framebox }
+ {
+ \draw_scope_begin:
+ \color_stroke:n { hanziboxframecolor }
+ \draw_path_rectangle_corners:nn { #1, #2} { #3, #4}
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
+ }
+% \end{macrocode}
+%
+% \changes{v2.1.1}{2021/10/07}{内格子线颜色独立设置}
+%
+% \begin{macrocode}
+\@@_new_frame_construct:nn { 十 }
+ {
+ \draw_scope_begin:
+ \tl_if_empty:NF \l_@@_dash_pattern_tl
+ {
+ \exp_args:No \draw_dash_pattern:nn { \l_@@_dash_pattern_tl } { 0pt }
+ }
+ \draw_linewidth:n{ \l_@@_cross_linewidth_dim }
+ \color_stroke:n { hanziboxcrosscolor }
+ \draw_path_moveto:n { (#3)/2, #2 }
+ \draw_path_lineto:n { #3/2, #4 }
+ \draw_path_moveto:n { #1, (#4)/2 }
+ \draw_path_lineto:n { #3, (#4)/2 }
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
}
\@@_new_frame_construct:nn { × }
{
- \tl_if_empty:NF \l_@@_dash_pattern_tl
- {
- \exp_args:No \draw_dash_pattern:nn { \l_@@_dash_pattern_tl } { 0pt }
- }
- \color_stroke:n { hanziboxcrosscolor }
- \draw_path_moveto:n { #1, #2 }
- \draw_path_lineto:n { #3, #4 }
- \draw_path_moveto:n { #1, #4 }
- \draw_path_lineto:n { #3, #2 }
- \draw_path_use_clear:n { stroke }
+ \draw_scope_begin:
+ \tl_if_empty:NF \l_@@_dash_pattern_tl
+ {
+ \exp_args:No \draw_dash_pattern:nn { \l_@@_dash_pattern_tl } { 0pt }
+ }
+ \draw_linewidth:n{ \l_@@_cross_linewidth_dim }
+ \color_stroke:n { hanziboxcrosscolor }
+ \draw_path_moveto:n { #1, #2 }
+ \draw_path_lineto:n { #3, #4 }
+ \draw_path_moveto:n { #1, #4 }
+ \draw_path_lineto:n { #3, #2 }
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
}
-\@@_new_frame_construct:nn { 田 }
+\@@_new_frame_construct:nn { 米 }
{
- \@@_frame_type_c:n { 口 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { × } {#1} {#2} {#3} {#4} {#5} {#6}
\@@_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
}
-\@@_new_frame_construct:nn { 米 }
+\@@_new_frame_construct:nn { 口 }
{
- \@@_frame_type_c:n { × } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { filledbox } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { framebox } {#1} {#2} {#3} {#4} {#5} {#6}
+ }
+
+\@@_new_frame_construct:nn { 田 }
+ {
+ \@@_frame_type_c:n { filledbox } {#1} {#2} {#3} {#4} {#5} {#6}
\@@_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { framebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
\@@_new_frame_construct:nn { 咪 }
{
- \@@_frame_type_c:n { 口 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { filledbox } {#1} {#2} {#3} {#4} {#5} {#6}
\@@_frame_type_c:n { × } {#1} {#2} {#3} {#4} {#5} {#6}
\@@_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \@@_frame_type_c:n { framebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
% \end{macrocode}
%
+% \subsubsection{定义边框类型错误提示信息}
+%
+% \begin{macrocode}
+\msg_new:nnn { hanzibox } { frame-exists } { The~ frame~ type~ `#1~ not~ exists. }
+% \end{macrocode}
+%
% \subsubsection{定义缩放方式}
%
% \begin{macro}{\@@_resize:n,\@@_resize_c:n}
-% 缩放方式命名函数
+% 生成缩放方式函数名称
% \begin{macrocode}
\cs_new_nopar:Npn \@@_resize:n #1
{
@@ -1196,7 +1450,7 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{\@@_new_resize_method:nn}
-% 缩放方式函数的定义函数。
+% 构建缩放方式列表及函数。
% \begin{macrocode}
\cs_new:Npn \@@_new_resize_method:nn #1
{
@@ -1206,6 +1460,8 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
+% \changes{v2.0.0}{2021/09/28}{删除square缩放样式}
+%
% 定义缩放方式函数。
% \begin{macrocode}
\@@_new_resize_method:nn { none } { }
@@ -1289,8 +1545,6 @@ Copyright and Licence
\msg_new:nnn { hanzibox } { frame-type } { using~ `#1'~ frame. }
% \end{macrocode}
%
-% \changes{v2.0.0}{2021/09/28}{删除square缩放样式}
-%
% \subsubsection{设置字号}
%
% \begin{macro}{\@@_zihao:n}
@@ -1300,16 +1554,50 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
-% \subsubsection{定义边框类型错误提示信息}
+% \changes{v2.2.0}{2021/10/08}{添加字符轮廓处理函数}
%
+% \subsubsection{字符轮廓处理函数}
+% 源码改自\LaTeX 的\pkg{zitie}宏包(\url{https://www.ctan.org/pkg/zitie})。
+%
+% \begin{macro}{\@@_chars_stroke:nn}
+% 设置字符轮廓函数
% \begin{macrocode}
-\msg_new:nnn { hanzibox } { frame-exists } { The~ frame~ type~ `#1~ not~ exists. }
+\cs_new:Npn \@@_chars_stroke:nn #1#2
+ {
+ \special { pdf:code ~ q ~ #1 } #2 \special { pdf:code ~ Q }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_chars_stroke:nn}
+% 字符轮廓选择函数
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_chars_stroke_construct:n #1
+ {
+ \int_case:nn {\l_@@_charstroke_type_int}
+ {
+ {1}{ #1 }
+ {2}{
+ \@@_chars_stroke:nn { 1 ~ Tr ~ 0.10 ~ w ~ [] ~ 0 ~ d ~ 1 ~ J } {#1}
+ }
+ {3}{
+ \@@_chars_stroke:nn { 1 ~ Tr ~ 0.10 ~ w ~ [1~1] ~ 0 ~ d ~ 1 ~ J } {#1}
+ }
+ {4}{
+ \@@_chars_stroke:nn { 3 ~ Tr } {#1}
+ }
+
+ }
+ }
+\cs_generate_variant:Nn \@@_chars_stroke_construct:n { V }
+\cs_generate_variant:Nn \@@_chars_stroke_construct:n { x }
% \end{macrocode}
+% \end{macro}
%
% \subsubsection{命名颜色}
%
% \begin{macro}{\@@_color_select:nn,\@@_color_select:nnn}
-% 颜色命名函数,注意使用的是l3语法
+% 颜色命名函数(使用l3语法)
% \begin{macrocode}
\cs_set_nopar:Npn \@@_color_select:nn #1#2
{
@@ -1369,16 +1657,20 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
+% \changes{v2.2.0}{2021/10/07}{为pinyinf选项增加计算拼音高度功能}
+%
% \begin{macro}{pinyinf}
-% 拼音的格式
+% 拼音格式
% \begin{macrocode}
- pinyinf .tl_set:N = \l_@@_pinyin_format_tl ,
+ pinyinf .code:n = { \tl_set:Nn \l_@@_pinyin_format_tl { #1 }
+ \@@_calc_pinyin_h:
+ },
pinyinf .initial:n = \tiny ,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{charf}
-% 汉字的格式
+% 汉字格式
% \begin{macrocode}
charf .code:n = { \tl_gset:Nn \l_@@_character_format_tl {#1}
\@@_calc_frame_size:
@@ -1387,7 +1679,7 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{tranf}
-% 译文的格式
+% 译文格式
% \begin{macrocode}
tranf .tl_set:N = \l_@@_translation_format_tl ,
tranf .initial:n = \tiny ,
@@ -1395,8 +1687,7 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{frametype}
-% 设置边框类型,其取值可以是:none-无方框,口–仅方框, 十–仅中间的横线和竖线,
-% 田–常见的田字格, 米–十字格再加上斜的两条线, 咪–常见的米字格。
+% 边框类型
% \begin{macrocode}
frametype .code:n = { \exp_args:NNx \clist_if_in:NnTF \g_@@_frame_list_clist {#1}
{ \tl_set:Nx \l_@@_frame_type_tl {#1} }
@@ -1406,10 +1697,7 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{resize}
-% resize 设置缩放方式,其取值可以是:
-% none,不使用缩放
-% real,使用字符实际宽高缩放,
-% base,使用 basechar 设置的字符的宽高缩放。
+% 缩放方式
% \begin{macrocode}
resize .code:n = { \exp_args:NNx \clist_if_in:NnTF \g_@@_resize_method_clist {#1}
{ \tl_set:Nx \l_@@_resize_method_tl {#1} }
@@ -1456,25 +1744,53 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{linewidth}
-% 线条宽度
+% 外框线条宽度
% \begin{macrocode}
- linewidth .dim_set:N = \l_@@_linewidth_dim ,
+ linewidth .dim_set:N = \l_@@_frame_linewidth_dim ,
linewidth .initial:n = 0.4pt ,
% \end{macrocode}
% \end{macro}
%
-% \changes{v2.1.1}{2021/10/07}{添加格子内部十字和米字线颜色与边框颜色比例选项corsscolorratio}
+% \changes{v2.2.0}{2021/10/10}{添加边框线线宽\opt{framelinewidth}选项}
+%
+% \begin{macro}{framelinewidth}
+% 外框线条宽度
+% \begin{macrocode}
+ framelinewidth .dim_set:N = \l_@@_frame_linewidth_dim ,
+ framelinewidth .initial:n = 0.4pt ,
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.2.0}{2021/10/10}{添加拼音四线格线宽pinyinlinewidth选项}
+%
+% \begin{macro}{pinyinlinewidth}
+% 拼音四线格线条宽度
+% \begin{macrocode}
+ pinyinlinewidth .dim_set:N = \l_@@_pinyin_linewidth_dim ,
+ pinyinlinewidth .initial:n = 0.4pt ,
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.2.0}{2021/10/10}{添加内格十字和米字线线宽crosslinewidth选项}
+%
+% \begin{macro}{crosslinewidth}
+% 内格十字和米字线线条宽度
+% \begin{macrocode}
+ crosslinewidth .dim_set:N = \l_@@_cross_linewidth_dim ,
+ crosslinewidth .initial:n = 0.3pt ,
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.1.1}{2021/10/07}{添加颜色比例选项corsscolorratio}
%
% \begin{macro}{crosscolorratio}
-% 边框颜色
+% 盒子内部线条颜色占边框颜色的百分比
% \begin{macrocode}
crosscolorratio .int_set:N = \l_@@_cross_color_ratio_int,
crosscolorratio .initial:n = 20,
% \end{macrocode}
% \end{macro}
%
-% \changes{v2.1.1}{2021/10/07}{为格子内部十字和米字线定义hanziboxcrosscolor颜色}
-%
% \begin{macro}{framecolor}
% 边框颜色
% \begin{macrocode}
@@ -1493,15 +1809,39 @@ Copyright and Licence
% \begin{macrocode}
charcolor .code:n = { \@@_color_select:nn { hanziboxcharcolor } {#1} } ,
charcolor .initial:n = black ,
- charcolor* .code:n = { \@@_color_select:nnn { hanziboxframecolor } {#1} } ,
+ charcolor* .code:n = { \@@_color_select:nnn { hanziboxcharcolor } #1 } ,
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.2.0}{2021/10/07}{添加拼音颜色\opt{pinyincolor}选项}
+%
+% \begin{macro}{pinyincolor}
+% 拼音颜色
+% \begin{macrocode}
+ pinyincolor .code:n = { \@@_color_select:nn { hanziboxpinyincolor } {#1} } ,
+ pinyincolor .initial:n = black ,
+ pinyincolor* .code:n = { \@@_color_select:nnn { hanziboxpinyincolor } #1 } ,
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.2.0}{2021/10/07}{添加译文颜色\opt{trancolor}选项}
+%
+% \begin{macro}{trancolor}
+% 译文颜色
+% \begin{macrocode}
+ trancolor .code:n = { \@@_color_select:nn { hanziboxtrancolor } {#1} } ,
+ trancolor .initial:n = black ,
+ trancolor* .code:n = { \@@_color_select:nnn { hanziboxtrancolor } #1 } ,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{color}
-% 同时设置边框和字符颜色
+% 同时设置边框、字符、拼音和译文颜色
% \begin{macrocode}
- color .meta:n = { framecolor = #1, charcolor = #1 } ,
- color* .meta:n = { framecolor* = #1, charcolor* = #1 } ,
+ color .meta:n = { framecolor = #1, crosscolor = #1, charcolor = #1,
+ pinyincolor = #1, trancolor = #1 } ,
+ color* .meta:n = { framecolor* = #1, crosscolor = #1, charcolor* = #1,
+ pinyincolor* = #1, trancolor* = #1 } ,
% \end{macrocode}
% \end{macro}
%
@@ -1521,6 +1861,20 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
+% \changes{v2.2.0}{2021/10/08}{添加字符轮廓类型charstroke选项}
+%
+% \begin{macro}{charstroke}
+% 设置汉字轮廓类型
+% \begin{macrocode}
+ charstroke .choice:,
+ charstroke .value_required:n = true,
+ charstroke .choices:nn =
+ { none, solid, dashed, invisible }
+ { \int_set_eq:NN \l_@@_charstroke_type_int \l_keys_choice_int },
+ charstroke .initial:n = none,
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{dashpattern}
% 虚线样式
% \begin{macrocode}
@@ -1530,7 +1884,7 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{framearc}
-% 转角半径
+% 矩形外框转角半径
% \begin{macrocode}
framearc .code:n = { \tl_set:Nn \l_@@_frame_arc_tl { {#1}{#1} } } ,
framearc* .tl_set:N = \l_@@_frame_arc_tl ,
@@ -1548,7 +1902,7 @@ Copyright and Licence
% \end{macro}
%
% \begin{macro}{autopinyin}
-% 是否使用\tn{xpyinyin*}命令通过汉字自动获取汉语拼音,默认为true。
+% 是否通过汉字自动获取拼音,默认为true。
% \begin{macrocode}
autopinyin .bool_set:N = \l_@@_autopinyin_bool,
autopinyin .default:n = true,
@@ -1587,10 +1941,22 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加隐藏拼音键。}
+% \changes{v2.2.0}{2021/10/07}{添加是否显示拼音线\opt{pinyinline}选项}
+%
+% \begin{macro}{pinyinline}
+% 是否绘制拼音四线格,默认为true。
+% \begin{macrocode}
+ pinyinline .bool_set:N = \l_@@_withpinyinlines_bool,
+ pinyinline .default:n = true,
+ pinyinline .initial:n = false,
+
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v1.1.0}{2021/09/21}{添加隐藏拼音、汉字和译文选项}
%
% \begin{macro}{pinyin}
-% 是否显示汉语拼音,默认为true。
+% 是否显示拼音,默认为true。
% \begin{macrocode}
pinyin .bool_set:N = \l_@@_withpinyin_bool,
pinyin .default:n = true,
@@ -1599,10 +1965,8 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加隐藏汉字键。}
-%
% \begin{macro}{hanzi}
-% 是否显示汉语拼音,默认为true。
+% 是否显示汉字,默认为true。
% \begin{macrocode}
hanzi .bool_set:N = \l_@@_withhanzi_bool,
hanzi .default:n = true,
@@ -1611,10 +1975,8 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.1.0}{2021/09/21}{添加隐藏译文键。}
-%
% \begin{macro}{tran}
-% 是否显示汉语拼音,默认为true。
+% 是否显示译文,默认为true。
% \begin{macrocode}
tran .bool_set:N = \l_@@_withtran_bool,
tran .default:n = true,
@@ -1644,8 +2006,6 @@ Copyright and Licence
tranf = \tiny ,
frametype = none ,
resize = none ,
- crosscolorratio = 20,
- framecolor = black,
}
% \end{macrocode}
@@ -1662,19 +2022,8 @@ Copyright and Licence
%
% \subsection{内部函数}
%
-% \begin{macro}{\@@_pinyinaux:n}
-% \begin{macro}{\@@_pinyinaux:x}
-% \pkg{xpyinyin}宏包\tn{pinyin} 命令的\LaTeX3{}版本函数及其函数变体。
-% \begin{macrocode}
- % \xpinyinsetup{pysep={\hspace*{1em}}}
-\cs_set_eq:NN \@@_pinyinaux:n \pinyin
-\cs_generate_variant:Nn \@@_pinyinaux:n { x }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
% \begin{macro}{\@@_dialog:nnnn}
-% 手动汉字盒子排版内部命令。
+% 手动汉字盒子排版命令。
% \begin{macrocode}
\cs_new:Npn \@@_dialog:nnnn #1#2#3#4
{
@@ -1685,70 +2034,127 @@ Copyright and Licence
\tl_set:Nx \l_@@_pinyin_tl {#3}
\tl_set:Nx \l_@@_translation_tl {#4}
- \hcoffin_set:Nn \l_@@_pinyin_box_coffin
- {
- \tl_use:N \l_@@_pinyin_format_tl
- \tl_use:N \l_@@_pinyin_tl
- }
\hcoffin_set:Nn \l_@@_str_box_coffin
{
\tl_map_inline:Nn \l_@@_character_tl
{
- \@@_single_handle:N ##1 \allowbreak
+ \@@_single_handle:N ##1
+ }
+ }
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \hcoffin_set:Nn \l_@@_pinyin_box_coffin
+ {
+ \color_select:n { hanziboxpinyincolor }
+ \tl_use:N \l_@@_pinyin_format_tl
+ \tl_use:N \l_@@_pinyin_tl
}
+ \dim_set:Nn \l_tmpa_dim { \coffin_wd:N \l_@@_pinyin_box_coffin }
+ \draw_begin:
+ \draw_linewidth:n { \l_@@_frame_linewidth_dim }
+ \color_stroke:n { hanziboxframecolor!50 }
+
+ \draw_path_scope_begin:
+ \@@_frame_type_c:n { pinyinlines }
+ { 0 } { 0 } { \l_tmpa_dim } { \hanziboxheight } { 1.0 } { 1.0 }
+ \draw_transform_shift:n {\l_tmpa_dim / 2.0, \l_@@_pinyin_height_i_dim }
+ \draw_coffin_use:Nnn \l_@@_pinyin_box_coffin { hc } { H }
+ \draw_path_scope_end:
+ \draw_end:
}
\hcoffin_set:Nn \l_@@_tran_box_coffin
{
\tl_use:N \l_@@_translation_format_tl
\tl_use:N \l_@@_translation_tl
}
- \coffin_join:NnnNnnnn \l_@@_str_box_coffin
- { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- \coffin_join:NnnNnnnn \l_@@_str_box_coffin
+ \coffin_join:NnnNnnnn \l_tmpa_coffin { hc } { b }
+ \l_@@_str_box_coffin { hc } { t } { 0pt } { \l_@@_frame_linewidth_dim }
+ \coffin_join:NnnNnnnn \l_tmpa_coffin
{ hc } { b } \l_@@_tran_box_coffin { hc } { t } { 0pt } { -2pt }
- \coffin_set_eq:NN \l_@@_box_coffin \l_@@_str_box_coffin
+ \coffin_set_eq:NN \l_@@_box_coffin \l_tmpa_coffin
\@@_resize_c:n { \l_@@_resize_method_tl }
\coffin_typeset:Nnnnn \l_@@_box_coffin
{ l } { b } { 0pt } { 0pt }
+ \allowbreak
\group_end:
}
% \end{macrocode}
% \end{macro}
%
% \changes{v2.0.1}{2021/09/28}{分离多字、单字、0个字的盒子构造代码}
-% \changes{v2.1.0}{2021/09/30}{更新拼音获取方式,以处理\tn{setuppinyin}的结果}
+% \changes{v2.1.0}{2021/09/30}{更新拼音获取方式}
+% \changes{v2.2.0}{2021/10/09}{分离汉字拼音coffin构造函数}
+%
+% \begin{macro}{\@@_single_pinyin_hanzi_construct:NN}
+% 构造单个拼音+汉字coffin。
+% \begin{macrocode}
+\cs_new:Npn \@@_single_pinyin_hanzi_construct:NN #1#2
+ {
+ \tl_if_empty:NTF #1
+ {
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \@@_single_handle:N \c_@@_basechar_tl
+ }
+ }
+ {
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \@@_single_handle:N #1
+ }
+ }
+
+ \tl_if_empty:NTF #2
+ {
+ \hcoffin_set:Nn \l_@@_pinyin_hanzi_coffin
+ {
+ \@@_single_pinyin_lines:
+ }
+
+ \coffin_join:NnnNnnnn \l_@@_pinyin_hanzi_coffin
+ { hc } { b } \l_tmpa_coffin { hc } { t } { 0pt } { \l_@@_pinyin_linewidth_dim }
+ }
+ {
+ \bool_if:NTF \l_@@_withpinyin_bool
+ {
+ \hcoffin_set:Nn \l_@@_pinyin_hanzi_coffin
+ {
+ \@@_single_pinyin:V #2
+ }
+
+ \coffin_join:NnnNnnnn \l_@@_pinyin_hanzi_coffin
+ { hc } { b } \l_tmpa_coffin { hc } { t } { 0pt } { \l_@@_pinyin_linewidth_dim }
+ }
+ {
+ \coffin_set_eq:NN \l_@@_pinyin_hanzi_coffin \l_tmpa_coffin
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\@@_multi_str_coffin_construct:}
% 构造多汉字带拼音字符串盒子。
% \begin{macrocode}
\cs_new:Npn \@@_multi_str_coffin_construct:
{
+ \hcoffin_set:Nn \l_@@_str_box_coffin
+ {
+ }
\bool_if:NTF \l_@@_autopinyin_bool
{
- \hcoffin_set:Nn \l_@@_str_box_coffin
+ \tl_map_inline:Nn \l_@@_character_tl
{
- \tl_map_inline:Nn \l_@@_character_tl
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \@@_single_handle:N ##1
- }
+ \@@_get_hanzi_pinyin:n { ##1 }
- \bool_if:NT \l_@@_withpinyin_bool
- {
- \@@_get_hanzi_pinyin:n { ##1 }
- \@@_single_pinyin:V \l_@@_hanzi_pinyin_tl
+ \@@_single_pinyin_hanzi_construct:NN ##1 \l_@@_hanzi_pinyin_tl
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin { r } { b }
+ \l_@@_pinyin_hanzi_coffin { l } { b }
+ { -\l_@@_frame_linewidth_dim } { 0pt }
}
}
{
@@ -1756,131 +2162,69 @@ Copyright and Licence
\clist_clear:N \l_@@_tone_pinyin_clist
\clist_set:NV \l_@@_tone_pinyin_clist \l_@@_tone_pinyin_tl
\int_set:Nn \l_tmpa_int {\clist_count:N \l_@@_tone_pinyin_clist}
- \hcoffin_set:Nn \l_@@_str_box_coffin
- {
- \int_compare:nNnTF { \l_@@_character_int } = { \l_tmpa_int }
- {
- \tl_map_inline:Nn \l_@@_character_tl
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \@@_single_handle:N ##1
- }
-
- \bool_if:NT \l_@@_withpinyin_bool
- {
- \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
- \@@_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- }
- {
- \int_compare:nNnTF { \l_@@_character_int } > { \l_tmpa_int }
- {
- \int_step_inline:nn { \l_tmpa_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l_@@_character_tl { ##1 }}
- \@@_single_handle:N \l_tmpa_tl
- }
- \bool_if:NT \l_@@_withpinyin_bool
- {
- \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
- \@@_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- \int_step_inline:nnn { \l_tmpa_int + 1 } { \l_@@_character_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l_@@_character_tl { ##1 }}
- \@@_single_handle:N \l_tmpa_tl
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- }
- {
- \int_step_inline:nn { \l_@@_character_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l_@@_character_tl { ##1 }}
- \@@_single_handle:N \l_tmpa_tl
- }
- \bool_if:NT \l_@@_withpinyin_bool
- {
- \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
- \@@_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
-
- \bool_if:NTF \l_@@_withhanzi_bool
- {
- \bool_set_false:N \l_@@_withhanzi_bool
- \int_step_inline:nnn { \l_@@_character_int + 1 } { \l_tmpa_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \@@_single_handle:N \c_@@_basechar_tl
- }
- \bool_if:NT \l_@@_withpinyin_bool
- {
- \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
- \@@_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- \bool_set_true:N \l_@@_withhanzi_bool
- }
- {
- \int_step_inline:nnn { \l_@@_character_int + 1 } { \l_tmpa_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \@@_single_handle:N \c_@@_basechar_tl
- }
- \bool_if:NT \l_@@_withpinyin_bool
- {
- \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
- \@@_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- }
- }
- }
- }
+ \int_compare:nNnTF { \l_@@_character_int } = { \l_tmpa_int }
+ {
+ \tl_map_inline:Nn \l_@@_character_tl
+ {
+ \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
+ \@@_single_pinyin_hanzi_construct:NN ##1 \l_tmpb_tl
+
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin { r } { b }
+ \l_@@_pinyin_hanzi_coffin { l } { b }
+ { -\l_@@_frame_linewidth_dim } { 0pt }
+ }
+ }
+ {
+ \int_compare:nNnTF { \l_@@_character_int } > { \l_tmpa_int }
+ {
+ \int_step_inline:nn { \l_tmpa_int }
+ {
+ \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l_@@_character_tl { ##1 }}
+ \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
+
+ \@@_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin { r } { b }
+ \l_@@_pinyin_hanzi_coffin { l } { b }
+ { -\l_@@_frame_linewidth_dim } { 0pt }
+ }
+ \int_step_inline:nnn { \l_tmpa_int + 1 } { \l_@@_character_int }
+ {
+ \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l_@@_character_tl { ##1 }}
+ \tl_clear:N \l_tmpb_tl
+
+ \@@_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin { r } { b }
+ \l_@@_pinyin_hanzi_coffin { l } { b }
+ { -\l_@@_frame_linewidth_dim } { 0pt }
+ }
+ }
+ {
+ \int_step_inline:nn { \l_@@_character_int }
+ {
+ \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l_@@_character_tl { ##1 }}
+ \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
+
+ \@@_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin { r } { b }
+ \l_@@_pinyin_hanzi_coffin { l } { b }
+ { -\l_@@_frame_linewidth_dim } { 0pt }
+ }
+
+ \bool_set_eq:NN \l_tmpa_bool \l_@@_withhanzi_bool
+ \bool_set_false:N \l_@@_withhanzi_bool
+ \int_step_inline:nnn { \l_@@_character_int + 1 } { \l_tmpa_int }
+ {
+ \tl_clear:N \l_tmpa_tl
+ \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
+
+ \@@_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin { r } { b }
+ \l_@@_pinyin_hanzi_coffin { l } { b }
+ { -\l_@@_frame_linewidth_dim } { 0pt }
+ }
+ \bool_set_eq:NN \l_@@_withhanzi_bool \l_tmpa_bool
+ }
+ }
}
}
% \end{macrocode}
@@ -1893,91 +2237,77 @@ Copyright and Licence
{
\bool_if:NTF \l_@@_autopinyin_bool
{
- \@@_multi_str_coffin_construct:
+ \hcoffin_set:Nn \l_@@_str_box_coffin
+ {
+ \@@_get_hanzi_pinyin:V \l_@@_character_tl
+
+ \@@_single_pinyin_hanzi_construct:NN
+ \l_@@_character_tl \l_@@_hanzi_pinyin_tl
+ \coffin_typeset:Nnnnn \l_@@_pinyin_hanzi_coffin
+ { l } { b } { 0pt } { 0pt }
+ }
}
{
\hcoffin_set:Nn \l_@@_str_box_coffin
{
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \@@_single_handle:N \l_@@_character_tl
- }
+ \@@_get_tone_pinyin:V \l_@@_pinyin_tl
+ \clist_clear:N \l_@@_tone_pinyin_clist
+ \clist_set:NV \l_@@_tone_pinyin_clist \l_@@_tone_pinyin_tl
+ \tl_set:Nx \l_tmpb_tl { \clist_use:Nn \l_@@_tone_pinyin_clist { } }
- \bool_if:NT \l_@@_withpinyin_bool
- {
- \hcoffin_set:Nn \l_@@_pinyin_box_coffin
- {
- \color_select:n { hanziboxcharcolor }
- \tl_use:N \l_@@_pinyin_format_tl
- \@@_get_tone_pinyin:V \l_@@_pinyin_tl
- \clist_clear:N \l_@@_tone_pinyin_clist
- \clist_set:NV \l_@@_tone_pinyin_clist \l_@@_tone_pinyin_tl
- \clist_use:Nn \l_@@_tone_pinyin_clist {}
- }
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
+ \@@_single_pinyin_hanzi_construct:NN \l_@@_character_tl \l_tmpb_tl
+ \coffin_typeset:Nnnnn \l_@@_pinyin_hanzi_coffin
{ l } { b } { 0pt } { 0pt }
- \allowbreak
}
}
}
% \end{macrocode}
% \end{macro}
%
-% \changes{v2.1.1}{2021/10/02}{修复无汉字手动拼音无法正确处理的问题}
+% \changes{v2.1.1}{2021/10/02}{修复无汉字手动拼音分割问题}
%
% \begin{macro}{\@@_null_str_coffin_construct:}
% 构造空白汉字(0个汉字)带拼音字符串盒子。
% \begin{macrocode}
\cs_new:Npn \@@_null_str_coffin_construct:
{
+ \bool_set_eq:NN \l_tmpa_bool \l_@@_withhanzi_bool
+ \bool_set_false:N \l_@@_withhanzi_bool
\bool_if:NTF \l_@@_autopinyin_bool
{
\hcoffin_set:Nn \l_@@_str_box_coffin
{
- \bool_set_false:N \l_@@_withhanzi_bool
\@@_single_handle:N \c_@@_basechar_tl
- \allowbreak
}
}
{
\hcoffin_set:Nn \l_@@_str_box_coffin
{
- \bool_if:NTF \l_@@_withpinyin_bool
- {
- \@@_get_tone_pinyin:V \l_@@_pinyin_tl
- \clist_clear:N \l_@@_tone_pinyin_clist
- \clist_set:NV \l_@@_tone_pinyin_clist \l_@@_tone_pinyin_tl
- \int_set:Nn \l_tmpa_int {\clist_count:N \l_@@_tone_pinyin_clist}
-
- \int_step_inline:nn { \l_tmpa_int }
- {
- \bool_set_false:N \l_@@_withhanzi_bool
-
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \@@_single_handle:N \c_@@_basechar_tl
- }
-
- \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
- \@@_single_pinyin:V \l_tmpb_tl
+ }
+ \bool_if:NTF \l_@@_withpinyin_bool
+ {
+ \@@_get_tone_pinyin:V \l_@@_pinyin_tl
+ \clist_clear:N \l_@@_tone_pinyin_clist
+ \clist_set:NV \l_@@_tone_pinyin_clist \l_@@_tone_pinyin_tl
+ \int_set:Nn \l_tmpa_int {\clist_count:N \l_@@_tone_pinyin_clist}
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l_@@_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- }
+ \int_step_inline:nn { \l_tmpa_int }
{
- \bool_set_false:N \l_@@_withhanzi_bool
- \@@_single_handle:N \c_@@_basechar_tl
- \allowbreak
+ \tl_clear:N \l_tmpa_tl
+ \clist_pop:NN \l_@@_tone_pinyin_clist \l_tmpb_tl
+
+ \@@_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l_@@_str_box_coffin { r } { b }
+ \l_@@_pinyin_hanzi_coffin { l } { b }
+ { -\l_@@_frame_linewidth_dim } { 0pt }
}
}
+ {
+ \bool_set_false:N \l_@@_withhanzi_bool
+ \@@_single_handle:N \c_@@_basechar_tl
+ }
}
+ \bool_set_eq:NN \l_@@_withhanzi_bool \l_tmpa_bool
}
% \end{macrocode}
% \end{macro}
@@ -2028,7 +2358,7 @@ Copyright and Licence
{
\hcoffin_set:Nn \l_@@_tran_box_coffin
{
- \color_select:n { hanziboxcharcolor }
+ \color_select:n { hanziboxtrancolor }
\tl_use:N \l_@@_translation_format_tl
\tl_use:N \l_@@_translation_tl
}
@@ -2042,6 +2372,7 @@ Copyright and Licence
\coffin_typeset:Nnnnn \l_@@_box_coffin
{ l } { b } { 0pt } { 0pt }
+ \allowbreak
\group_end:
}
% \end{macrocode}
@@ -2062,7 +2393,7 @@ Copyright and Licence
\@@_split_pinyin_withtone:n { #1 }
\hcoffin_set:Nn \l_@@_pinyin_box_coffin
{
- \color_select:n { hanziboxcharcolor }
+ \color_select:n { hanziboxpinyincolor }
\tl_use:N \l_@@_pinyin_format_tl
\bool_if:NTF \l_@@_withinitial_bool
@@ -2093,7 +2424,7 @@ Copyright and Licence
{
\hcoffin_set:Nn \l_@@_pinyin_box_coffin
{
- \color_select:n { hanziboxcharcolor }
+ \color_select:n { hanziboxpinyincolor }
\tl_use:N \l_@@_pinyin_format_tl
#1
}
@@ -2103,12 +2434,13 @@ Copyright and Licence
\@@_split_pinyin_withouttone:n { #1 }
\hcoffin_set:Nn \l_@@_pinyin_box_coffin
{
- \color_select:n { hanziboxcharcolor }
+ \color_select:n { hanziboxtrancolor }
\tl_use:N \l_@@_pinyin_format_tl
\tl_use:N \l_@@_pinyin_tl
}
}
+ \@@_single_pinyin_lines_construct:
}
\cs_generate_variant:Nn \@@_single_pinyin:n { V }
\cs_generate_variant:Nn \@@_single_pinyin:n { x }
@@ -2143,6 +2475,7 @@ Copyright and Licence
% \end{macro}
%
% \changes{v2.0.0}{2021/09/27}{删除单个汉字构造中添加拼音的功能}
+% \changes{v2.2.0}{2021/10/08}{为汉字添加字符轮廓处理}
%
% \begin{macro}{\@@_single_construct:N}
% 构造单个汉字盒子
@@ -2155,7 +2488,7 @@ Copyright and Licence
{
\color_select:n { hanziboxcharcolor }
\tl_use:N \l_@@_character_format_tl
- #1
+ \@@_chars_stroke_construct:n { #1 }
}
}
{
@@ -2184,7 +2517,7 @@ Copyright and Licence
\cs_new:Npn \@@_single_frame_construct:
{
\draw_begin:
- \draw_linewidth:n { \l_@@_linewidth_dim }
+ \draw_linewidth:n { \l_@@_frame_linewidth_dim }
\@@_aux_color_fill:
\color_stroke:n { hanziboxframecolor }
@@ -2201,6 +2534,46 @@ Copyright and Licence
% \end{macrocode}
% \end{macro}
%
+% \changes{v2.2.0}{2021/10/07}{添加构造单个拼音盒子函数}
+%
+% \begin{macro}{\@@_single_pinyin_lines_construct:}
+% 构造单个拼音盒子
+% \begin{macrocode}
+\cs_new:Npn \@@_single_pinyin_lines_construct:
+ {
+ \draw_begin:
+ \draw_linewidth:n { \l_@@_pinyin_linewidth_dim }
+ \color_stroke:n { hanziboxframecolor!50 }
+
+ \draw_path_scope_begin:
+ \@@_frame_type_c:n { pinyinlines }
+ { 0 } { 0 } { \hanziboxwidth } { \hanziboxheight } { 1.0 } { 1.0 }
+ \draw_transform_shift:n {\hanziboxwidth / 2.0, \l_@@_pinyin_height_i_dim }
+ \draw_coffin_use:Nnn \l_@@_pinyin_box_coffin { hc } { H }
+ \draw_path_scope_end:
+ \draw_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.2.0}{2021/10/07}{添加构造单个拼音线函数}
+%
+% \begin{macro}{\@@_single_pinyin_lines:}
+% 构造单个拼音线
+% \begin{macrocode}
+\cs_new:Npn \@@_single_pinyin_lines:
+ {
+ \draw_begin:
+ \draw_linewidth:n { \l_@@_pinyin_linewidth_dim }
+ \color_stroke:n { hanziboxframecolor!50 }
+
+ \@@_frame_type_c:n { pinyinlines }
+ { 0 } { 0 } { \hanziboxwidth } { \hanziboxheight } { 1.0 } { 1.0 }
+ \draw_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{\pkg{xpinyin}宏包拼音后处理函数}
%
% \changes{v2.1.0}{2021/09/30}{添加从xpinyin宏包中提取拼音串函数。}
@@ -2293,6 +2666,7 @@ Copyright and Licence
}
{ \tl_set_eq:NN \l_@@_hanzi_pinyin_tl \l_tmpa_tl }
}
+\cs_generate_variant:Nn \@@_get_hanzi_pinyin:n { V }
% \end{macrocode}
% \end{macro}
%
diff --git a/Master/texmf-dist/tex/xelatex/hanzibox/hanzibox.sty b/Master/texmf-dist/tex/xelatex/hanzibox/hanzibox.sty
index 3d9641749d9..2cc012a0b5c 100644
--- a/Master/texmf-dist/tex/xelatex/hanzibox/hanzibox.sty
+++ b/Master/texmf-dist/tex/xelatex/hanzibox/hanzibox.sty
@@ -27,7 +27,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{expl3}
-\GetIdInfo$Id: hanzibox.dtx 2.1.1 2021-10-07 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
+\GetIdInfo$Id: hanzibox.dtx 2.2.0 2021-10-11 08:00:00 +0800 Nan Geng <nangeng@nwafu.edu.cn> $
{Boxed Chinese characters with Pinyin above and translation below.}
\ProvidesExplPackage{\ExplFileName}
{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -79,6 +79,7 @@
\bool_new:N \l__hanzibox_withvowel_bool
\bool_new:N \l__hanzibox_withtone_bool
\bool_new:N \l__hanzibox_withpinyin_bool
+\bool_new:N \l__hanzibox_withpinyinlines_bool
\bool_new:N \l__hanzibox_withhanzi_bool
\bool_new:N \l__hanzibox_withtran_bool
@@ -90,9 +91,14 @@
\dim_new:N \l__hanzibox_frame_size_dim
\dim_new:N \l__hanzibox_char_width_dim
\dim_new:N \l__hanzibox_char_height_dim
+\dim_new:N \l__hanzibox_pinyin_height_i_dim
+\dim_new:N \l__hanzibox_pinyin_height_ii_dim
+\dim_new:N \l__hanzibox_pinyin_height_iii_dim
\dim_new:N \l__hanzibox_box_width_dim
\dim_new:N \l__hanzibox_box_height_dim
-\dim_new:N \l__hanzibox_linewidth_dim
+\dim_new:N \l__hanzibox_frame_linewidth_dim
+\dim_new:N \l__hanzibox_pinyin_linewidth_dim
+\dim_new:N \l__hanzibox_cross_linewidth_dim
\clist_new:N \l__hanzibox_tone_pinyin_clist
@@ -100,6 +106,7 @@
\coffin_new:N \l__hanzibox_box_coffin
\coffin_new:N \l__hanzibox_pinyin_box_coffin
\coffin_new:N \l__hanzibox_tran_box_coffin
+\coffin_new:N \l__hanzibox_pinyin_hanzi_coffin
\coffin_new:N \l__hanzibox_tmpa_coffin
\coffin_new:N \l__hanzibox_tmpb_coffin
@@ -116,6 +123,7 @@
\int_new:N \l__hanzibox_pinyin_int
\int_new:N \l__hanzibox_character_int
\int_new:N \l__hanzibox_translation_int
+\int_new:N \l__hanzibox_charstroke_type_int
\int_new:N \l__hanzibox_tone_int
\str_new:N \l__hanzibox_pinyin_str
@@ -124,6 +132,26 @@
\cs_new_nopar:Nn \__hanzibox_aux_color_fill:
{ }
+\cs_new:Npn \__hanzibox_calc_pinyin_h:
+ {
+ \hbox_set:Nn \l_tmpa_box
+ {
+ \tl_use:N \l__hanzibox_pinyin_format_tl
+ a
+ }
+ \dim_set:Nn \l__hanzibox_pinyin_height_i_dim
+ {
+ \box_ht:N \l_tmpa_box
+ }
+ \dim_set:Nn \l__hanzibox_pinyin_height_ii_dim
+ {
+ \l__hanzibox_pinyin_height_i_dim + \l__hanzibox_pinyin_height_i_dim
+ }
+ \dim_set:Nn \l__hanzibox_pinyin_height_iii_dim
+ {
+ \l__hanzibox_pinyin_height_i_dim + \l__hanzibox_pinyin_height_i_dim + \l__hanzibox_pinyin_height_i_dim
+ }
+ }
\cs_new:Npn \__hanzibox_calc_basechar_w_h:
{
\dim_set:Nn \l__hanzibox_char_width_dim
@@ -164,7 +192,7 @@
\dim_gset_eq:NN \l__hanzibox_frame_size_dim \l_tmpb_dim
}
- \dim_gadd:Nn \l__hanzibox_frame_size_dim { 2pt }
+ \dim_gadd:Nn \l__hanzibox_frame_size_dim { 1pt }
\dim_gset_eq:NN \hanziboxwidth \l__hanzibox_frame_size_dim
\dim_gset_eq:NN \hanziboxheight \l__hanzibox_frame_size_dim
@@ -187,65 +215,116 @@
\cs_new:cn { \__hanzibox_frame_type:n {#1} }
}
\__hanzibox_new_frame_construct:nn { none } { }
-\__hanzibox_new_frame_construct:nn { 口 }
+\__hanzibox_new_frame_construct:nn { pinyinlines }
{
- \color_stroke:n { hanziboxframecolor }
- \draw_path_rectangle_corners:nn { #1, #2} { #3, #4}
-
- \cs_if_eq:NNTF \__hanzibox_aux_color_fill: \c_empty_tl
+ \bool_if:NTF \l__hanzibox_withpinyinlines_bool
{
- \draw_path_use_clear:n { stroke }
+ \draw_scope_begin:
+ \draw_path_moveto:n { #1, 0 }
+ \draw_path_lineto:n { #3, 0 }
+ \draw_path_moveto:n { #1, \l__hanzibox_pinyin_height_i_dim }
+ \draw_path_lineto:n { #3, \l__hanzibox_pinyin_height_i_dim }
+ \draw_path_moveto:n { #1, \l__hanzibox_pinyin_height_ii_dim }
+ \draw_path_lineto:n { #3, \l__hanzibox_pinyin_height_ii_dim }
+ \draw_path_moveto:n { #1, \l__hanzibox_pinyin_height_iii_dim }
+ \draw_path_lineto:n { #3, \l__hanzibox_pinyin_height_iii_dim }
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
}
{
- \draw_path_use_clear:n { stroke , fill }
+ \draw_scope_begin:
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \tl_use:N \l__hanzibox_pinyin_format_tl
+ \phantom{a}
+ }
+
+ \coffin_resize:Nnn \l_tmpa_coffin
+ { #3 } { \l__hanzibox_pinyin_height_iii_dim }
+
+ \draw_coffin_use:Nnn \l_tmpa_coffin { l } { b }
+ \draw_scope_end:
}
}
-\__hanzibox_new_frame_construct:nn { 十 }
+\__hanzibox_new_frame_construct:nn { filledbox }
{
- \tl_if_empty:NF \l__hanzibox_dash_pattern_tl
+ \cs_if_eq:NNF \__hanzibox_aux_color_fill: \c_empty_tl
{
- \exp_args:No \draw_dash_pattern:nn { \l__hanzibox_dash_pattern_tl } { 0pt }
+ \color_stroke:n { hanziboxframecolor }
+ \draw_path_rectangle_corners:nn { #1, #2} { #3, #4}
+
+ \draw_path_use_clear:n { stroke, fill }
}
- \color_stroke:n { hanziboxcrosscolor }
- \draw_path_moveto:n { (#3)/2, #2 }
- \draw_path_lineto:n { #3/2, #4 }
- \draw_path_moveto:n { #1, (#4)/2 }
- \draw_path_lineto:n { #3, (#4)/2 }
- \draw_path_use_clear:n { stroke }
+ }
+\__hanzibox_new_frame_construct:nn { framebox }
+ {
+ \draw_scope_begin:
+ \color_stroke:n { hanziboxframecolor }
+ \draw_path_rectangle_corners:nn { #1, #2} { #3, #4}
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
+ }
+\__hanzibox_new_frame_construct:nn { 十 }
+ {
+ \draw_scope_begin:
+ \tl_if_empty:NF \l__hanzibox_dash_pattern_tl
+ {
+ \exp_args:No \draw_dash_pattern:nn { \l__hanzibox_dash_pattern_tl } { 0pt }
+ }
+ \draw_linewidth:n{ \l__hanzibox_cross_linewidth_dim }
+ \color_stroke:n { hanziboxcrosscolor }
+ \draw_path_moveto:n { (#3)/2, #2 }
+ \draw_path_lineto:n { #3/2, #4 }
+ \draw_path_moveto:n { #1, (#4)/2 }
+ \draw_path_lineto:n { #3, (#4)/2 }
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
}
\__hanzibox_new_frame_construct:nn { × }
{
- \tl_if_empty:NF \l__hanzibox_dash_pattern_tl
- {
- \exp_args:No \draw_dash_pattern:nn { \l__hanzibox_dash_pattern_tl } { 0pt }
- }
- \color_stroke:n { hanziboxcrosscolor }
- \draw_path_moveto:n { #1, #2 }
- \draw_path_lineto:n { #3, #4 }
- \draw_path_moveto:n { #1, #4 }
- \draw_path_lineto:n { #3, #2 }
- \draw_path_use_clear:n { stroke }
+ \draw_scope_begin:
+ \tl_if_empty:NF \l__hanzibox_dash_pattern_tl
+ {
+ \exp_args:No \draw_dash_pattern:nn { \l__hanzibox_dash_pattern_tl } { 0pt }
+ }
+ \draw_linewidth:n{ \l__hanzibox_cross_linewidth_dim }
+ \color_stroke:n { hanziboxcrosscolor }
+ \draw_path_moveto:n { #1, #2 }
+ \draw_path_lineto:n { #3, #4 }
+ \draw_path_moveto:n { #1, #4 }
+ \draw_path_lineto:n { #3, #2 }
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
}
-\__hanzibox_new_frame_construct:nn { 田 }
+\__hanzibox_new_frame_construct:nn { 米 }
{
- \__hanzibox_frame_type_c:n { 口 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__hanzibox_frame_type_c:n { × } {#1} {#2} {#3} {#4} {#5} {#6}
\__hanzibox_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
}
-\__hanzibox_new_frame_construct:nn { 米 }
+\__hanzibox_new_frame_construct:nn { 口 }
{
- \__hanzibox_frame_type_c:n { × } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__hanzibox_frame_type_c:n { filledbox } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__hanzibox_frame_type_c:n { framebox } {#1} {#2} {#3} {#4} {#5} {#6}
+ }
+
+\__hanzibox_new_frame_construct:nn { 田 }
+ {
+ \__hanzibox_frame_type_c:n { filledbox } {#1} {#2} {#3} {#4} {#5} {#6}
\__hanzibox_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__hanzibox_frame_type_c:n { framebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
\__hanzibox_new_frame_construct:nn { 咪 }
{
- \__hanzibox_frame_type_c:n { 口 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__hanzibox_frame_type_c:n { filledbox } {#1} {#2} {#3} {#4} {#5} {#6}
\__hanzibox_frame_type_c:n { × } {#1} {#2} {#3} {#4} {#5} {#6}
\__hanzibox_frame_type_c:n { 十 } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__hanzibox_frame_type_c:n { framebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
+\msg_new:nnn { hanzibox } { frame-exists } { The~ frame~ type~ `#1~ not~ exists. }
\cs_new_nopar:Npn \__hanzibox_resize:n #1
{
__hanzibox_processor_resize_ #1 :w
@@ -371,7 +450,29 @@
\msg_new:nnn { hanzibox } { frame-type } { using~ `#1'~ frame. }
\cs_new_nopar:Npn \__hanzibox_zihao:n #1 { \zihao {#1} }
-\msg_new:nnn { hanzibox } { frame-exists } { The~ frame~ type~ `#1~ not~ exists. }
+\cs_new:Npn \__hanzibox_chars_stroke:nn #1#2
+ {
+ \special { pdf:code ~ q ~ #1 } #2 \special { pdf:code ~ Q }
+ }
+\cs_new_protected:Npn \__hanzibox_chars_stroke_construct:n #1
+ {
+ \int_case:nn {\l__hanzibox_charstroke_type_int}
+ {
+ {1}{ #1 }
+ {2}{
+ \__hanzibox_chars_stroke:nn { 1 ~ Tr ~ 0.10 ~ w ~ [] ~ 0 ~ d ~ 1 ~ J } {#1}
+ }
+ {3}{
+ \__hanzibox_chars_stroke:nn { 1 ~ Tr ~ 0.10 ~ w ~ [1~1] ~ 0 ~ d ~ 1 ~ J } {#1}
+ }
+ {4}{
+ \__hanzibox_chars_stroke:nn { 3 ~ Tr } {#1}
+ }
+
+ }
+ }
+\cs_generate_variant:Nn \__hanzibox_chars_stroke_construct:n { V }
+\cs_generate_variant:Nn \__hanzibox_chars_stroke_construct:n { x }
\cs_set_nopar:Npn \__hanzibox_color_select:nn #1#2
{
\color_set:nn {#1} {#2}
@@ -398,7 +499,9 @@
}
\__hanzibox_calc_basechar_w_h:
},
- pinyinf .tl_set:N = \l__hanzibox_pinyin_format_tl ,
+ pinyinf .code:n = { \tl_set:Nn \l__hanzibox_pinyin_format_tl { #1 }
+ \__hanzibox_calc_pinyin_h:
+ },
pinyinf .initial:n = \tiny ,
charf .code:n = { \tl_gset:Nn \l__hanzibox_character_format_tl {#1}
\__hanzibox_calc_frame_size:
@@ -420,8 +523,14 @@
scale .meta:n = { xscale = #1 , yscale = #1 } ,
width .dim_set:N = \l__hanzibox_box_width_dim ,
height .dim_set:N = \l__hanzibox_box_height_dim ,
- linewidth .dim_set:N = \l__hanzibox_linewidth_dim ,
+ linewidth .dim_set:N = \l__hanzibox_frame_linewidth_dim ,
linewidth .initial:n = 0.4pt ,
+ framelinewidth .dim_set:N = \l__hanzibox_frame_linewidth_dim ,
+ framelinewidth .initial:n = 0.4pt ,
+ pinyinlinewidth .dim_set:N = \l__hanzibox_pinyin_linewidth_dim ,
+ pinyinlinewidth .initial:n = 0.4pt ,
+ crosslinewidth .dim_set:N = \l__hanzibox_cross_linewidth_dim ,
+ crosslinewidth .initial:n = 0.3pt ,
crosscolorratio .int_set:N = \l__hanzibox_cross_color_ratio_int,
crosscolorratio .initial:n = 20,
framecolor .code:n = { \tl_set:Nx \l_tmpa_tl { #1 ! \int_use:N \l__hanzibox_cross_color_ratio_int }
@@ -433,9 +542,17 @@
\__hanzibox_color_select:nnx { hanziboxcrosscolor } \l_tmpa_tl } ,
charcolor .code:n = { \__hanzibox_color_select:nn { hanziboxcharcolor } {#1} } ,
charcolor .initial:n = black ,
- charcolor* .code:n = { \__hanzibox_color_select:nnn { hanziboxframecolor } {#1} } ,
- color .meta:n = { framecolor = #1, charcolor = #1 } ,
- color* .meta:n = { framecolor* = #1, charcolor* = #1 } ,
+ charcolor* .code:n = { \__hanzibox_color_select:nnn { hanziboxcharcolor } #1 } ,
+ pinyincolor .code:n = { \__hanzibox_color_select:nn { hanziboxpinyincolor } {#1} } ,
+ pinyincolor .initial:n = black ,
+ pinyincolor* .code:n = { \__hanzibox_color_select:nnn { hanziboxpinyincolor } #1 } ,
+ trancolor .code:n = { \__hanzibox_color_select:nn { hanziboxtrancolor } {#1} } ,
+ trancolor .initial:n = black ,
+ trancolor* .code:n = { \__hanzibox_color_select:nnn { hanziboxtrancolor } #1 } ,
+ color .meta:n = { framecolor = #1, crosscolor = #1, charcolor = #1,
+ pinyincolor = #1, trancolor = #1 } ,
+ color* .meta:n = { framecolor* = #1, crosscolor = #1, charcolor* = #1,
+ pinyincolor* = #1, trancolor* = #1 } ,
fillcolor .code:n = { \exp_args:Nx \tl_if_empty:nTF {#1}
{ \__hanzibox_color_select:nn { hanziboxfillcolor } { white }
\cs_set_nopar:Npn \__hanzibox_aux_color_fill: { }
@@ -446,6 +563,12 @@
fillcolor* .code:n = { \__hanzibox_color_select:nnn { hanziboxfillcolor } #1
\cs_set_nopar:Npn \__hanzibox_aux_color_fill: { \color_fill:nn #1 }
} ,
+ charstroke .choice:,
+ charstroke .value_required:n = true,
+ charstroke .choices:nn =
+ { none, solid, dashed, invisible }
+ { \int_set_eq:NN \l__hanzibox_charstroke_type_int \l_keys_choice_int },
+ charstroke .initial:n = none,
dashpattern .tl_set:N = \l__hanzibox_dash_pattern_tl ,
dashpattern .initial:n = { } ,
framearc .code:n = { \tl_set:Nn \l__hanzibox_frame_arc_tl { {#1}{#1} } } ,
@@ -470,6 +593,10 @@
tone .default:n = true,
tone .initial:n = true,
+ pinyinline .bool_set:N = \l__hanzibox_withpinyinlines_bool,
+ pinyinline .default:n = true,
+ pinyinline .initial:n = false,
+
pinyin .bool_set:N = \l__hanzibox_withpinyin_bool,
pinyin .default:n = true,
pinyin .initial:n = true,
@@ -496,15 +623,10 @@
tranf = \tiny ,
frametype = none ,
resize = none ,
- crosscolorratio = 20,
- framecolor = black,
}
\NewDocumentCommand \hanziboxset { m }
{ \keys_set:nn { hanzibox } {#1} }
- % \xpinyinsetup{pysep={\hspace*{1em}}}
-\cs_set_eq:NN \__hanzibox_pinyinaux:n \pinyin
-\cs_generate_variant:Nn \__hanzibox_pinyinaux:n { x }
\cs_new:Npn \__hanzibox_dialog:nnnn #1#2#3#4
{
\group_begin:
@@ -514,61 +636,111 @@
\tl_set:Nx \l__hanzibox_pinyin_tl {#3}
\tl_set:Nx \l__hanzibox_translation_tl {#4}
- \hcoffin_set:Nn \l__hanzibox_pinyin_box_coffin
- {
- \tl_use:N \l__hanzibox_pinyin_format_tl
- \tl_use:N \l__hanzibox_pinyin_tl
- }
\hcoffin_set:Nn \l__hanzibox_str_box_coffin
{
\tl_map_inline:Nn \l__hanzibox_character_tl
{
- \__hanzibox_single_handle:N ##1 \allowbreak
+ \__hanzibox_single_handle:N ##1
+ }
+ }
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \hcoffin_set:Nn \l__hanzibox_pinyin_box_coffin
+ {
+ \color_select:n { hanziboxpinyincolor }
+ \tl_use:N \l__hanzibox_pinyin_format_tl
+ \tl_use:N \l__hanzibox_pinyin_tl
}
+ \dim_set:Nn \l_tmpa_dim { \coffin_wd:N \l__hanzibox_pinyin_box_coffin }
+ \draw_begin:
+ \draw_linewidth:n { \l__hanzibox_frame_linewidth_dim }
+ \color_stroke:n { hanziboxframecolor!50 }
+
+ \draw_path_scope_begin:
+ \__hanzibox_frame_type_c:n { pinyinlines }
+ { 0 } { 0 } { \l_tmpa_dim } { \hanziboxheight } { 1.0 } { 1.0 }
+ \draw_transform_shift:n {\l_tmpa_dim / 2.0, \l__hanzibox_pinyin_height_i_dim }
+ \draw_coffin_use:Nnn \l__hanzibox_pinyin_box_coffin { hc } { H }
+ \draw_path_scope_end:
+ \draw_end:
}
\hcoffin_set:Nn \l__hanzibox_tran_box_coffin
{
\tl_use:N \l__hanzibox_translation_format_tl
\tl_use:N \l__hanzibox_translation_tl
}
- \coffin_join:NnnNnnnn \l__hanzibox_str_box_coffin
- { hc } { t } \l__hanzibox_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- \coffin_join:NnnNnnnn \l__hanzibox_str_box_coffin
+ \coffin_join:NnnNnnnn \l_tmpa_coffin { hc } { b }
+ \l__hanzibox_str_box_coffin { hc } { t } { 0pt } { \l__hanzibox_frame_linewidth_dim }
+ \coffin_join:NnnNnnnn \l_tmpa_coffin
{ hc } { b } \l__hanzibox_tran_box_coffin { hc } { t } { 0pt } { -2pt }
- \coffin_set_eq:NN \l__hanzibox_box_coffin \l__hanzibox_str_box_coffin
+ \coffin_set_eq:NN \l__hanzibox_box_coffin \l_tmpa_coffin
\__hanzibox_resize_c:n { \l__hanzibox_resize_method_tl }
\coffin_typeset:Nnnnn \l__hanzibox_box_coffin
{ l } { b } { 0pt } { 0pt }
+ \allowbreak
\group_end:
}
+\cs_new:Npn \__hanzibox_single_pinyin_hanzi_construct:NN #1#2
+ {
+ \tl_if_empty:NTF #1
+ {
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \__hanzibox_single_handle:N \c__hanzibox_basechar_tl
+ }
+ }
+ {
+ \hcoffin_set:Nn \l_tmpa_coffin
+ {
+ \__hanzibox_single_handle:N #1
+ }
+ }
+
+ \tl_if_empty:NTF #2
+ {
+ \hcoffin_set:Nn \l__hanzibox_pinyin_hanzi_coffin
+ {
+ \__hanzibox_single_pinyin_lines:
+ }
+
+ \coffin_join:NnnNnnnn \l__hanzibox_pinyin_hanzi_coffin
+ { hc } { b } \l_tmpa_coffin { hc } { t } { 0pt } { \l__hanzibox_pinyin_linewidth_dim }
+ }
+ {
+ \bool_if:NTF \l__hanzibox_withpinyin_bool
+ {
+ \hcoffin_set:Nn \l__hanzibox_pinyin_hanzi_coffin
+ {
+ \__hanzibox_single_pinyin:V #2
+ }
+
+ \coffin_join:NnnNnnnn \l__hanzibox_pinyin_hanzi_coffin
+ { hc } { b } \l_tmpa_coffin { hc } { t } { 0pt } { \l__hanzibox_pinyin_linewidth_dim }
+ }
+ {
+ \coffin_set_eq:NN \l__hanzibox_pinyin_hanzi_coffin \l_tmpa_coffin
+ }
+ }
+ }
\cs_new:Npn \__hanzibox_multi_str_coffin_construct:
{
+ \hcoffin_set:Nn \l__hanzibox_str_box_coffin
+ {
+ }
\bool_if:NTF \l__hanzibox_autopinyin_bool
{
- \hcoffin_set:Nn \l__hanzibox_str_box_coffin
+ \tl_map_inline:Nn \l__hanzibox_character_tl
{
- \tl_map_inline:Nn \l__hanzibox_character_tl
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \__hanzibox_single_handle:N ##1
- }
+ \__hanzibox_get_hanzi_pinyin:n { ##1 }
- \bool_if:NT \l__hanzibox_withpinyin_bool
- {
- \__hanzibox_get_hanzi_pinyin:n { ##1 }
- \__hanzibox_single_pinyin:V \l__hanzibox_hanzi_pinyin_tl
+ \__hanzibox_single_pinyin_hanzi_construct:NN ##1 \l__hanzibox_hanzi_pinyin_tl
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l__hanzibox_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
+ \coffin_join:NnnNnnnn \l__hanzibox_str_box_coffin { r } { b }
+ \l__hanzibox_pinyin_hanzi_coffin { l } { b }
+ { -\l__hanzibox_frame_linewidth_dim } { 0pt }
}
}
{
@@ -576,214 +748,138 @@
\clist_clear:N \l__hanzibox_tone_pinyin_clist
\clist_set:NV \l__hanzibox_tone_pinyin_clist \l__hanzibox_tone_pinyin_tl
\int_set:Nn \l_tmpa_int {\clist_count:N \l__hanzibox_tone_pinyin_clist}
- \hcoffin_set:Nn \l__hanzibox_str_box_coffin
- {
- \int_compare:nNnTF { \l__hanzibox_character_int } = { \l_tmpa_int }
- {
- \tl_map_inline:Nn \l__hanzibox_character_tl
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \__hanzibox_single_handle:N ##1
- }
-
- \bool_if:NT \l__hanzibox_withpinyin_bool
- {
- \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
- \__hanzibox_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l__hanzibox_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- }
- {
- \int_compare:nNnTF { \l__hanzibox_character_int } > { \l_tmpa_int }
- {
- \int_step_inline:nn { \l_tmpa_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l__hanzibox_character_tl { ##1 }}
- \__hanzibox_single_handle:N \l_tmpa_tl
- }
- \bool_if:NT \l__hanzibox_withpinyin_bool
- {
- \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
- \__hanzibox_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l__hanzibox_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- \int_step_inline:nnn { \l_tmpa_int + 1 } { \l__hanzibox_character_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l__hanzibox_character_tl { ##1 }}
- \__hanzibox_single_handle:N \l_tmpa_tl
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- }
- {
- \int_step_inline:nn { \l__hanzibox_character_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l__hanzibox_character_tl { ##1 }}
- \__hanzibox_single_handle:N \l_tmpa_tl
- }
- \bool_if:NT \l__hanzibox_withpinyin_bool
- {
- \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
- \__hanzibox_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l__hanzibox_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
-
- \bool_if:NTF \l__hanzibox_withhanzi_bool
- {
- \bool_set_false:N \l__hanzibox_withhanzi_bool
- \int_step_inline:nnn { \l__hanzibox_character_int + 1 } { \l_tmpa_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \__hanzibox_single_handle:N \c__hanzibox_basechar_tl
- }
- \bool_if:NT \l__hanzibox_withpinyin_bool
- {
- \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
- \__hanzibox_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l__hanzibox_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- \bool_set_true:N \l__hanzibox_withhanzi_bool
- }
- {
- \int_step_inline:nnn { \l__hanzibox_character_int + 1 } { \l_tmpa_int }
- {
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \__hanzibox_single_handle:N \c__hanzibox_basechar_tl
- }
- \bool_if:NT \l__hanzibox_withpinyin_bool
- {
- \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
- \__hanzibox_single_pinyin:V \l_tmpb_tl
-
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l__hanzibox_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- }
- }
- }
- }
+ \int_compare:nNnTF { \l__hanzibox_character_int } = { \l_tmpa_int }
+ {
+ \tl_map_inline:Nn \l__hanzibox_character_tl
+ {
+ \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
+ \__hanzibox_single_pinyin_hanzi_construct:NN ##1 \l_tmpb_tl
+
+ \coffin_join:NnnNnnnn \l__hanzibox_str_box_coffin { r } { b }
+ \l__hanzibox_pinyin_hanzi_coffin { l } { b }
+ { -\l__hanzibox_frame_linewidth_dim } { 0pt }
+ }
+ }
+ {
+ \int_compare:nNnTF { \l__hanzibox_character_int } > { \l_tmpa_int }
+ {
+ \int_step_inline:nn { \l_tmpa_int }
+ {
+ \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l__hanzibox_character_tl { ##1 }}
+ \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
+
+ \__hanzibox_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l__hanzibox_str_box_coffin { r } { b }
+ \l__hanzibox_pinyin_hanzi_coffin { l } { b }
+ { -\l__hanzibox_frame_linewidth_dim } { 0pt }
+ }
+ \int_step_inline:nnn { \l_tmpa_int + 1 } { \l__hanzibox_character_int }
+ {
+ \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l__hanzibox_character_tl { ##1 }}
+ \tl_clear:N \l_tmpb_tl
+
+ \__hanzibox_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l__hanzibox_str_box_coffin { r } { b }
+ \l__hanzibox_pinyin_hanzi_coffin { l } { b }
+ { -\l__hanzibox_frame_linewidth_dim } { 0pt }
+ }
+ }
+ {
+ \int_step_inline:nn { \l__hanzibox_character_int }
+ {
+ \tl_set:Nx \l_tmpa_tl {\tl_item:Nn \l__hanzibox_character_tl { ##1 }}
+ \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
+
+ \__hanzibox_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l__hanzibox_str_box_coffin { r } { b }
+ \l__hanzibox_pinyin_hanzi_coffin { l } { b }
+ { -\l__hanzibox_frame_linewidth_dim } { 0pt }
+ }
+
+ \bool_set_eq:NN \l_tmpa_bool \l__hanzibox_withhanzi_bool
+ \bool_set_false:N \l__hanzibox_withhanzi_bool
+ \int_step_inline:nnn { \l__hanzibox_character_int + 1 } { \l_tmpa_int }
+ {
+ \tl_clear:N \l_tmpa_tl
+ \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
+
+ \__hanzibox_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l__hanzibox_str_box_coffin { r } { b }
+ \l__hanzibox_pinyin_hanzi_coffin { l } { b }
+ { -\l__hanzibox_frame_linewidth_dim } { 0pt }
+ }
+ \bool_set_eq:NN \l__hanzibox_withhanzi_bool \l_tmpa_bool
+ }
+ }
}
}
\cs_new:Npn \__hanzibox_single_str_coffin_construct:
{
\bool_if:NTF \l__hanzibox_autopinyin_bool
{
- \__hanzibox_multi_str_coffin_construct:
+ \hcoffin_set:Nn \l__hanzibox_str_box_coffin
+ {
+ \__hanzibox_get_hanzi_pinyin:V \l__hanzibox_character_tl
+
+ \__hanzibox_single_pinyin_hanzi_construct:NN
+ \l__hanzibox_character_tl \l__hanzibox_hanzi_pinyin_tl
+ \coffin_typeset:Nnnnn \l__hanzibox_pinyin_hanzi_coffin
+ { l } { b } { 0pt } { 0pt }
+ }
}
{
\hcoffin_set:Nn \l__hanzibox_str_box_coffin
{
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \__hanzibox_single_handle:N \l__hanzibox_character_tl
- }
+ \__hanzibox_get_tone_pinyin:V \l__hanzibox_pinyin_tl
+ \clist_clear:N \l__hanzibox_tone_pinyin_clist
+ \clist_set:NV \l__hanzibox_tone_pinyin_clist \l__hanzibox_tone_pinyin_tl
+ \tl_set:Nx \l_tmpb_tl { \clist_use:Nn \l__hanzibox_tone_pinyin_clist { } }
- \bool_if:NT \l__hanzibox_withpinyin_bool
- {
- \hcoffin_set:Nn \l__hanzibox_pinyin_box_coffin
- {
- \color_select:n { hanziboxcharcolor }
- \tl_use:N \l__hanzibox_pinyin_format_tl
- \__hanzibox_get_tone_pinyin:V \l__hanzibox_pinyin_tl
- \clist_clear:N \l__hanzibox_tone_pinyin_clist
- \clist_set:NV \l__hanzibox_tone_pinyin_clist \l__hanzibox_tone_pinyin_tl
- \clist_use:Nn \l__hanzibox_tone_pinyin_clist {}
- }
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l__hanzibox_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
+ \__hanzibox_single_pinyin_hanzi_construct:NN \l__hanzibox_character_tl \l_tmpb_tl
+ \coffin_typeset:Nnnnn \l__hanzibox_pinyin_hanzi_coffin
{ l } { b } { 0pt } { 0pt }
- \allowbreak
}
}
}
\cs_new:Npn \__hanzibox_null_str_coffin_construct:
{
+ \bool_set_eq:NN \l_tmpa_bool \l__hanzibox_withhanzi_bool
+ \bool_set_false:N \l__hanzibox_withhanzi_bool
\bool_if:NTF \l__hanzibox_autopinyin_bool
{
\hcoffin_set:Nn \l__hanzibox_str_box_coffin
{
- \bool_set_false:N \l__hanzibox_withhanzi_bool
\__hanzibox_single_handle:N \c__hanzibox_basechar_tl
- \allowbreak
}
}
{
\hcoffin_set:Nn \l__hanzibox_str_box_coffin
{
- \bool_if:NTF \l__hanzibox_withpinyin_bool
- {
- \__hanzibox_get_tone_pinyin:V \l__hanzibox_pinyin_tl
- \clist_clear:N \l__hanzibox_tone_pinyin_clist
- \clist_set:NV \l__hanzibox_tone_pinyin_clist \l__hanzibox_tone_pinyin_tl
- \int_set:Nn \l_tmpa_int {\clist_count:N \l__hanzibox_tone_pinyin_clist}
-
- \int_step_inline:nn { \l_tmpa_int }
- {
- \bool_set_false:N \l__hanzibox_withhanzi_bool
-
- \hcoffin_set:Nn \l_tmpa_coffin
- {
- \__hanzibox_single_handle:N \c__hanzibox_basechar_tl
- }
-
- \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
- \__hanzibox_single_pinyin:V \l_tmpb_tl
+ }
+ \bool_if:NTF \l__hanzibox_withpinyin_bool
+ {
+ \__hanzibox_get_tone_pinyin:V \l__hanzibox_pinyin_tl
+ \clist_clear:N \l__hanzibox_tone_pinyin_clist
+ \clist_set:NV \l__hanzibox_tone_pinyin_clist \l__hanzibox_tone_pinyin_tl
+ \int_set:Nn \l_tmpa_int {\clist_count:N \l__hanzibox_tone_pinyin_clist}
- \coffin_join:NnnNnnnn \l_tmpa_coffin
- { hc } { t } \l__hanzibox_pinyin_box_coffin { hc } { H } { 0pt } { 3pt }
- \coffin_typeset:Nnnnn \l_tmpa_coffin
- { l } { b } { 0pt } { 0pt }
- \allowbreak
- }
- }
+ \int_step_inline:nn { \l_tmpa_int }
{
- \bool_set_false:N \l__hanzibox_withhanzi_bool
- \__hanzibox_single_handle:N \c__hanzibox_basechar_tl
- \allowbreak
+ \tl_clear:N \l_tmpa_tl
+ \clist_pop:NN \l__hanzibox_tone_pinyin_clist \l_tmpb_tl
+
+ \__hanzibox_single_pinyin_hanzi_construct:NN \l_tmpa_tl \l_tmpb_tl
+ \coffin_join:NnnNnnnn \l__hanzibox_str_box_coffin { r } { b }
+ \l__hanzibox_pinyin_hanzi_coffin { l } { b }
+ { -\l__hanzibox_frame_linewidth_dim } { 0pt }
}
}
+ {
+ \bool_set_false:N \l__hanzibox_withhanzi_bool
+ \__hanzibox_single_handle:N \c__hanzibox_basechar_tl
+ }
}
+ \bool_set_eq:NN \l__hanzibox_withhanzi_bool \l_tmpa_bool
}
\cs_new:Npn \__hanzibox_handle:nnnn #1#2#3#4
{
@@ -824,7 +920,7 @@
{
\hcoffin_set:Nn \l__hanzibox_tran_box_coffin
{
- \color_select:n { hanziboxcharcolor }
+ \color_select:n { hanziboxtrancolor }
\tl_use:N \l__hanzibox_translation_format_tl
\tl_use:N \l__hanzibox_translation_tl
}
@@ -838,6 +934,7 @@
\coffin_typeset:Nnnnn \l__hanzibox_box_coffin
{ l } { b } { 0pt } { 0pt }
+ \allowbreak
\group_end:
}
\cs_new:Npn \__hanzibox_single_pinyin:n #1
@@ -849,7 +946,7 @@
\__hanzibox_split_pinyin_withtone:n { #1 }
\hcoffin_set:Nn \l__hanzibox_pinyin_box_coffin
{
- \color_select:n { hanziboxcharcolor }
+ \color_select:n { hanziboxpinyincolor }
\tl_use:N \l__hanzibox_pinyin_format_tl
\bool_if:NTF \l__hanzibox_withinitial_bool
@@ -880,7 +977,7 @@
{
\hcoffin_set:Nn \l__hanzibox_pinyin_box_coffin
{
- \color_select:n { hanziboxcharcolor }
+ \color_select:n { hanziboxpinyincolor }
\tl_use:N \l__hanzibox_pinyin_format_tl
#1
}
@@ -890,12 +987,13 @@
\__hanzibox_split_pinyin_withouttone:n { #1 }
\hcoffin_set:Nn \l__hanzibox_pinyin_box_coffin
{
- \color_select:n { hanziboxcharcolor }
+ \color_select:n { hanziboxtrancolor }
\tl_use:N \l__hanzibox_pinyin_format_tl
\tl_use:N \l__hanzibox_pinyin_tl
}
}
+ \__hanzibox_single_pinyin_lines_construct:
}
\cs_generate_variant:Nn \__hanzibox_single_pinyin:n { V }
\cs_generate_variant:Nn \__hanzibox_single_pinyin:n { x }
@@ -928,7 +1026,7 @@
{
\color_select:n { hanziboxcharcolor }
\tl_use:N \l__hanzibox_character_format_tl
- #1
+ \__hanzibox_chars_stroke_construct:n { #1 }
}
}
{
@@ -949,7 +1047,7 @@
\cs_new:Npn \__hanzibox_single_frame_construct:
{
\draw_begin:
- \draw_linewidth:n { \l__hanzibox_linewidth_dim }
+ \draw_linewidth:n { \l__hanzibox_frame_linewidth_dim }
\__hanzibox_aux_color_fill:
\color_stroke:n { hanziboxframecolor }
@@ -963,6 +1061,30 @@
\draw_path_scope_end:
\draw_end:
}
+\cs_new:Npn \__hanzibox_single_pinyin_lines_construct:
+ {
+ \draw_begin:
+ \draw_linewidth:n { \l__hanzibox_pinyin_linewidth_dim }
+ \color_stroke:n { hanziboxframecolor!50 }
+
+ \draw_path_scope_begin:
+ \__hanzibox_frame_type_c:n { pinyinlines }
+ { 0 } { 0 } { \hanziboxwidth } { \hanziboxheight } { 1.0 } { 1.0 }
+ \draw_transform_shift:n {\hanziboxwidth / 2.0, \l__hanzibox_pinyin_height_i_dim }
+ \draw_coffin_use:Nnn \l__hanzibox_pinyin_box_coffin { hc } { H }
+ \draw_path_scope_end:
+ \draw_end:
+ }
+\cs_new:Npn \__hanzibox_single_pinyin_lines:
+ {
+ \draw_begin:
+ \draw_linewidth:n { \l__hanzibox_pinyin_linewidth_dim }
+ \color_stroke:n { hanziboxframecolor!50 }
+
+ \__hanzibox_frame_type_c:n { pinyinlines }
+ { 0 } { 0 } { \hanziboxwidth } { \hanziboxheight } { 1.0 } { 1.0 }
+ \draw_end:
+ }
\tl_new:N \l__hanzibox_save_tl
\tl_new:N \l__hanzibox_hanzi_pinyin_tl
\tl_new:N \l__hanzibox_tone_pinyin_tl
@@ -1026,6 +1148,7 @@
}
{ \tl_set_eq:NN \l__hanzibox_hanzi_pinyin_tl \l_tmpa_tl }
}
+\cs_generate_variant:Nn \__hanzibox_get_hanzi_pinyin:n { V }
\clist_set:Nn \l__hanzibox_initials_clist
{
{zh} , {ch} , {sh} , {b} , {p} , {m} , {f} ,