summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-04-28 20:23:12 +0000
committerKarl Berry <karl@freefriends.org>2022-04-28 20:23:12 +0000
commit1d30e8b2253c6e3894e15f2fdccee8f2bb19146d (patch)
tree126a7e7175cee97addd65fbc1040d89bb4d6fb0b /Master
parent482c373a24651974162df19d2736d1b1b8ef6166 (diff)
circledtext (28apr22)
git-svn-id: svn://tug.org/texlive/trunk@63166 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/circledtext/circledtext.pdfbin209214 -> 214742 bytes
-rw-r--r--Master/texmf-dist/doc/latex/circledtext/circledtext.tex109
-rw-r--r--Master/texmf-dist/tex/latex/circledtext/circledtext.sty425
3 files changed, 350 insertions, 184 deletions
diff --git a/Master/texmf-dist/doc/latex/circledtext/circledtext.pdf b/Master/texmf-dist/doc/latex/circledtext/circledtext.pdf
index aa7369ad60c..63396e64fcd 100644
--- a/Master/texmf-dist/doc/latex/circledtext/circledtext.pdf
+++ b/Master/texmf-dist/doc/latex/circledtext/circledtext.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/circledtext/circledtext.tex b/Master/texmf-dist/doc/latex/circledtext/circledtext.tex
index ec6201932e8..2df0d98782f 100644
--- a/Master/texmf-dist/doc/latex/circledtext/circledtext.tex
+++ b/Master/texmf-dist/doc/latex/circledtext/circledtext.tex
@@ -119,7 +119,7 @@
{ \__codedoc_cmd:no {#1} { #2 } }
\ExplSyntaxOff
-\def\vers{\texttt{v1.0.0} }
+\def\vers{\texttt{v1.1.0} }
\begin{document}
\title{
@@ -149,7 +149,7 @@
\pkg{circledtext}是一个基于\pkg{l3draw}用\pkg{expl3}开发的
排版带圈文字的宏包,它提供了唯一的一个排版命令\tn{circledtext}%
-用于对其必选参数中的字符(串)按指定的基字符大小缩放后,再为其添加
+用于对其必选参数中的文本按指定的基字符大小缩放后,再为其添加
圆形边框,然后排版输出。其带星号``*''命令\tn{circledtext*}用于
实现反色阴文排版输出。可以通过该命令的命令选项或\tn{circledtextset}%
命令设置排版输出的不同外观。
@@ -160,13 +160,13 @@
\begin{function}{\circledtext}
\begin{syntax}
- \cs{circledtext} \oarg{外观选项} \marg{字符(串)}
+ \cs{circledtext} \oarg{外观选项} \marg{文本}
\end{syntax}
\end{function}
- 按设置的\oarg{外观选项}对指定的\marg{字符(串)}添加圆圈后排版输出。
+ 按设置的\oarg{外观选项}对指定的\marg{文本}添加圆圈后排版输出。
- 该命令仅有一个必选参数\marg{字符(串)},用于指定需要排版的文本。
+ 该命令仅有一个必选参数\marg{文本},用于指定需要排版的文本。
在\oarg{外观选项}中可以通过key-value的方式设置颜色、字体、字号、线宽等外观。
@@ -193,7 +193,7 @@
\end{syntax}
\end{function}
- 用于设置一个外围圆圈及字符(串)的外观。
+ 用于设置外围圆圈及文本的外观。
在\marg{外观选项}中可以通过key-value方式设置颜色、
字体、字号、线宽等外观。
@@ -204,42 +204,46 @@
\begin{option}{ opt = basechar, desc = {= \meta{基字符}}, init=好/x }
设置尺寸测度基字符,如果使用|xetex|或|luatex|引擎编译
- 则初始值为中文“好”字,否则使用英文``x''。
+ 则初始值为中文“好”字,否则使用英文字母``x''。
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
\centering
\circledtext{五}\quad
\circledtext{一佰}\quad
- \circledtext[basechar=m]{999}
+ \circledtext[basechar=M]{999}
\end{SideBySideExample}
\bigskip
\begin{option}{ opt = charf, desc = {= \meta{格式命令}}, init=\tn{normalsize} }
- 设置字符(串)格式,初始值为\tn{normalsize}。
+ 设置文本格式,初始值为\tn{normalsize}。
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
\centering
\circledtext{五}\qquad
- \circledtext[charf=\Huge\sffamily]{九}
+ \circledtext[charf=\Huge]{九}
\end{SideBySideExample}
+% 字体设置会影响后续内容,原因还未查明
\bigskip
\begin{option}{ opt = boxtype, desc = {= \meta{外框类型}}, init=o }
设置外框类型,目前支持:
\end{option}\\
\begin{Description}
- \item |o|---实心填充圆(小写英文字母``o'')。
+ \item |o|---实心填充圆(小写英文字母``|o|'')。
\item |o+|---十字填充圆。
- \item |ox|---对角十字填充圆(小写英文字母``x'')。
+ \item |ox|---对角十字填充圆(小写英文字母``|x|'')。
\item |ox+|---米字填充圆。
- \item |x+|---米字填充背景。
- \item |O|---实心填充正方形(大写英文字母``O'')。
+ \item |x+|---米字背景(边框为圆但不显示)。
+ \item |O|---实心填充正方形(大写英文字母``|O|'')。
\item |O+|---十字填充正方形。
- \item |OX|---对角十字填充正方形(小写英文字母``X'')。
+ \item |OX|---对角十字填充正方形(小写英文字母``|X|'')。
\item |OX+|---米字填充正方形。
- \item |X+|---米字填充背景。
+ \item |X+|---米字背景(边框为正方形但不显示)。
+ \item |oo|---同心圆背景。
+ \item |Oo|---前景色填充正方叠加背景色圆背景。
+ \item |OO|---同心正方形背景。
\end{Description}
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2]
\centering
@@ -259,6 +263,30 @@
\circledtext[boxtype=X+ ]{戊}
\end{SideBySideExample}
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2]
+ \centering
+ \circledtextset{boxcolor=red}
+ \circledtext[boxtype=oo ]{车}\quad
+ \circledtext[boxtype=Oo ]{马}\quad
+ \circledtext[boxtype=OO ]{炮}\quad
+ \circledtext*[boxtype=oo ]{车}\quad
+ \circledtext*[boxtype=Oo ]{马}\quad
+ \circledtext*[boxtype=OO ]{炮}
+\end{SideBySideExample}
+
+\bigskip
+
+\begin{option}{ opt = charshrink, desc = {= \meta{文本缩放系数}}, init=0.75 }
+ 设置文本缩放系数。
+\end{option}\\
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \centering
+ \circledtext[charshrink=0.75]{甲}\quad
+ \circledtext[charshrink=1.00]{乙}\quad
+ \circledtext[charshrink=0.50]{丙}\quad
+ \circledtext[charshrink=0.35]{丁}
+\end{SideBySideExample}
+
\bigskip
\begin{option}{ opt = resize, desc = {= \meta{缩放方式}}, init=none }
@@ -381,8 +409,8 @@
\bigskip
-\begin{option}{ opt = charcolor, desc = {= \meta{字符(串)颜色}}, init=black }
- 设置字符(串)颜色。
+\begin{option}{ opt = charcolor, desc = {= \meta{文本颜色}}, init=black }
+ 设置文本颜色。
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
\centering
@@ -408,7 +436,7 @@
\bigskip
\begin{option}{ opt = charstroke, desc = {= \meta{笔画类型}}, init=无 }
- 设置字符(串)笔画类型。
+ 设置文本笔画类型。
\end{option}\\
\begin{Description}
\item |none|---原始笔画轮廓。
@@ -515,7 +543,7 @@ text.
\centering
\circledtext{8}\quad
\circledtext{100}\quad
- \circledtext[basechar=m]{three}
+ \circledtext[basechar=M]{three}
\end{SideBySideExample}
\bigskip
@@ -526,7 +554,7 @@ text.
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
\centering
\circledtext{8}\qquad
- \circledtext[charf=\Huge\sffamily]{9}
+ \circledtext[charf=\Huge]{9}
\end{SideBySideExample}
\bigskip
@@ -539,12 +567,15 @@ text.
\item |o+|---filled circle with cross.
\item |ox|---filled circle with diagonal cross(lowercase "x").
\item |ox+|---filled circle with diagonal cross and cross.
- \item |x+|---diagonal cross and cross.
- \item |O|---filled circle(capital "O").
- \item |O+|---filled circle with cross.
- \item |OX|---filled circle with diagonal cross(capital "X").
- \item |OX+|---filled circle with diagonal cross and cross.
- \item |X+|---diagonal cross and cross.
+ \item |x+|---diagonal cross and cross(hided circle bg).
+ \item |O|---filled square(capital "O").
+ \item |O+|---filled square with cross.
+ \item |OX|---filled square with diagonal cross(capital "X").
+ \item |OX+|---filled square with diagonal cross and cross.
+ \item |X+|---diagonal cross and cross(hided square bg).
+ \item |oo|---2 concentric circles.
+ \item |Oo|---filled square with fg color and filled circle with bg color.
+ \item |OO|---2 concentric squares.
\end{Description}
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2]
\centering
@@ -564,6 +595,30 @@ text.
\circledtext[boxtype=X+ ]{14}
\end{SideBySideExample}
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.50\linewidth,gobble=2]
+ \centering
+ \circledtextset{boxcolor=red}
+ \circledtext[boxtype=oo ]{88}\quad
+ \circledtext[boxtype=Oo ]{88}\quad
+ \circledtext[boxtype=OO ]{88}\quad
+ \circledtext*[boxtype=oo ]{88}\quad
+ \circledtext*[boxtype=Oo ]{88}\quad
+ \circledtext*[boxtype=OO ]{88}
+\end{SideBySideExample}
+
+\bigskip
+
+\begin{option}{ opt = charshrink, desc = {= \meta{text shrink}}, init=0.75 }
+ Set text shrink ratio.
+\end{option}\\
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \centering
+ \circledtext[charshrink=0.75]{8}\quad
+ \circledtext[charshrink=1.00]{8}\quad
+ \circledtext[charshrink=0.50]{8}\quad
+ \circledtext[charshrink=0.35]{8}
+\end{SideBySideExample}
+
\bigskip
\begin{option}{ opt = resize, desc = {= \meta{resize type}}, init=none }
diff --git a/Master/texmf-dist/tex/latex/circledtext/circledtext.sty b/Master/texmf-dist/tex/latex/circledtext/circledtext.sty
index d8f125043fb..f70b7168141 100644
--- a/Master/texmf-dist/tex/latex/circledtext/circledtext.sty
+++ b/Master/texmf-dist/tex/latex/circledtext/circledtext.sty
@@ -19,7 +19,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{expl3}
-\ProvidesExplPackage{circledtext}{2022-04-24}{v1.0.0}
+\ProvidesExplPackage{circledtext}{2022-04-28}{v1.1.0}
{Typeset circled text with l3draw}
\RequirePackage { xtemplate, l3keys2e, l3draw, xparse }
@@ -109,10 +109,16 @@
% 字符(串)的字形类型(实线、虚线等)
\int_new:N \l__circledtext_charstroke_type_int
+% 字体自身缩放比例
+\fp_new:N \l__circledtext_char_shrink_fp
+
% 填充色辅助函数
\cs_new_nopar:Nn \__circledtext_aux_color_boxfill:
{ }
+% 盒子由l3draw实现,
+% 设计思路和部分源码来自zitie宏包(\url{https://www.ctan.org/pkg/zitie})。
+
% 颜色命名函数
% #1 颜色名称
% #2 颜色表达式
@@ -244,8 +250,67 @@
% 无边框
\__circledtext_new_char_box_construct:nn { none } { }
-% 实心正方形
-\__circledtext_new_char_box_construct:nn { filledsquare }
+% 填充正方形
+\__circledtext_new_char_box_construct:nn { __filledsquare }
+ {
+ \cs_if_eq:NNF \__circledtext_aux_color_boxfill: \c_empty_tl
+ {
+ \__circledtext_aux_color_boxfill:
+ \draw_scope_begin:
+ \bool_if:NTF \l__circledtext_negative_bool
+ {
+ \color_fill:n { circledtextcharcolor }
+ }{
+ \color_fill:n { circledtextboxfill }
+ }
+ \draw_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 }
+ \draw_path_rectangle:nn { #1, #2 } { #3*#5, #4*#6 }
+ \draw_path_use_clear:n { fill }
+ \draw_scope_end:
+ }
+ }
+
+% 反色填充正方形
+\__circledtext_new_char_box_construct:nn { __negfilledsquare }
+ {
+ \cs_if_eq:NNF \__circledtext_aux_color_boxfill: \c_empty_tl
+ {
+ \__circledtext_aux_color_boxfill:
+ \draw_scope_begin:
+ \bool_if:NTF \l__circledtext_negative_bool
+ {
+ \color_fill:n { circledtextboxfill }
+ }{
+ \color_fill:n { circledtextcharcolor }
+ }
+ \draw_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 }
+ \draw_path_rectangle:nn { #1, #2 } { #3*#5, #4*#6 }
+ \draw_path_use_clear:n { fill }
+ \draw_scope_end:
+ }
+ }
+
+% 正方形填充内切圆
+\__circledtext_new_char_box_construct:nn { __innerfilledcircle }
+ {
+ \cs_if_eq:NNF \__circledtext_aux_color_boxfill: \c_empty_tl
+ {
+ \__circledtext_aux_color_boxfill:
+ \draw_scope_begin:
+ \bool_if:NTF \l__circledtext_negative_bool
+ {
+ \color_fill:n { circledtextcharcolor }
+ }{
+ \color_fill:n { circledtextboxfill }
+ }
+ \draw_path_circle:nn { #3/2, #4/2 } { #3*#5/2 }
+ \draw_path_use_clear:n { fill }
+ \draw_scope_end:
+ }
+ }
+
+% 正方形填充外接圆
+\__circledtext_new_char_box_construct:nn { __outerfilledcircle }
{
\cs_if_eq:NNF \__circledtext_aux_color_boxfill: \c_empty_tl
{
@@ -257,25 +322,47 @@
}{
\color_fill:n { circledtextboxfill }
}
- % \color_fill:n { circledtextboxfill }
- \draw_path_rectangle:nn { #1, #2 } { #3, #4 }
+ \draw_path_circle:nn { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 }
\draw_path_use_clear:n { fill }
\draw_scope_end:
}
}
-% 外框正方形
-\__circledtext_new_char_box_construct:nn { boxsquare }
+% 正方形边框
+\__circledtext_new_char_box_construct:nn { __squarebox }
+ {
+ \draw_scope_begin:
+ \color_stroke:n { circledtextcharboxcolor }
+ \draw_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 }
+ \draw_path_rectangle:nn { #1, #2 } { #3*#5, #4*#6 }
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
+ }
+
+% 正方形内切圆边框
+\__circledtext_new_char_box_construct:nn { __innercirclebox }
+ {
+ \__circledtext_aux_color_boxfill:
+ \draw_scope_begin:
+ \color_stroke:n { circledtextcharboxcolor }
+ \draw_path_circle:nn { #3/2, #4/2 } { #3*#5/2 }
+ \draw_path_use_clear:n { stroke }
+ \draw_scope_end:
+ }
+
+% 正方形外接圆边框
+\__circledtext_new_char_box_construct:nn { __outercirclebox }
{
\draw_scope_begin:
\color_stroke:n { circledtextcharboxcolor }
- \draw_path_rectangle:nn { #1, #2 } { #3, #4 }
+ \draw_path_circle:nn { #3/2, #4/2 }
+ { \l__circledtext_char_box_radius_dim*#5 }
\draw_path_use_clear:n { stroke }
\draw_scope_end:
}
-% 正方形对角十字线
-\__circledtext_new_char_box_construct:nn { dcrosssquare }
+% 正方形斜十字线(正方形对角连线)
+\__circledtext_new_char_box_construct:nn { __dcross }
{
\draw_scope_begin:
\tl_if_empty:NF \l__circledtext_dash_pattern_tl
@@ -284,16 +371,17 @@
}
\draw_linewidth:n{ \l__circledtext_cross_linewidth_dim }
\color_stroke:n { circledtextcrosscolor }
- \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_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 }
+ \draw_path_moveto:n { #1 , #2 }
+ \draw_path_lineto:n { #3*#5, #4*#6 }
+ \draw_path_moveto:n { #1 , #4*#6 }
+ \draw_path_lineto:n { #3 , #2*#5 }
\draw_path_use_clear:n { stroke }
\draw_scope_end:
}
-% 对角十字线
-\__circledtext_new_char_box_construct:nn { crosssquare }
+% 正方形正十字线(正方形对边中点连线)
+\__circledtext_new_char_box_construct:nn { __scross }
{
\draw_scope_begin:
\tl_if_empty:NF \l__circledtext_dash_pattern_tl
@@ -302,50 +390,63 @@
}
\draw_linewidth:n{ \l__circledtext_cross_linewidth_dim }
\color_stroke:n { circledtextcrosscolor }
- \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_transform_shift:n { (#3-#3*#5)/2, (#4-#4*#6)/2 }
+ \draw_path_moveto:n { #3*#5/2, #2 }
+ \draw_path_lineto:n { #3*#5/2, #4*#6 }
+ \draw_path_moveto:n { #1 , #4*#6/2 }
+ \draw_path_lineto:n { #3*#5 , #4*#6/2 }
\draw_path_use_clear:n { stroke }
\draw_scope_end:
}
-% 实心圆
-\__circledtext_new_char_box_construct:nn { filledcircle }
- {
- \cs_if_eq:NNF \__circledtext_aux_color_boxfill: \c_empty_tl
- {
- \__circledtext_aux_color_boxfill:
- \draw_scope_begin:
- \bool_if:NTF \l__circledtext_negative_bool
- {
- \color_fill:n { circledtextcharcolor }
- }{
- \color_fill:n { circledtextboxfill }
- }
- % \color_fill:n { circledtextboxfill }
- \draw_path_circle:nn
- { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} }
- { \l__circledtext_char_box_radius_dim }
- \draw_path_use_clear:n { fill }
- \draw_scope_end:
- }
- }
-
-% 外框圆
-\__circledtext_new_char_box_construct:nn { boxcircle }
+% 内切圆斜十字线(需要求交点)
+\__circledtext_new_char_box_construct:nn { __innerdcross }
{
\draw_scope_begin:
- \color_stroke:n { circledtextcharboxcolor }
- \draw_path_circle:nn
- { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} }
- { \l__circledtext_char_box_radius_dim }
+ \tl_if_empty:NF \l__circledtext_dash_pattern_tl
+ {
+ \exp_args:No \draw_dash_pattern:nn { \l__circledtext_dash_pattern_tl } { 0pt }
+ }
+ \draw_linewidth:n{ \l__circledtext_cross_linewidth_dim }
+ \color_stroke:n { circledtextcrosscolor }
+ \draw_path_moveto:n
+ {
+ \draw_point_intersect_line_circle:nnnnn
+ { #1, #2 } % line's first point
+ { #3, #4 } % line's second point
+ { #3/2, #4/2 } { #3*#5/2 }
+ {1} % index of intersect
+ }
+ \draw_path_lineto:n
+ {
+ \draw_point_intersect_line_circle:nnnnn
+ { #1, #2 } % line's first point
+ { #3, #4 } % line's second point
+ { #3/2, #4/2 } { #3*#5/2 }
+ {2} % index of intersect
+ }
+ \draw_path_moveto:n
+ {
+ \draw_point_intersect_line_circle:nnnnn
+ { #1, #4 } % line's first point
+ { #3, #2 } % line's second point
+ { #3/2, #4/2 } { #3*#5/2 }
+ {1} % index of intersect
+ }
+ \draw_path_lineto:n
+ {
+ \draw_point_intersect_line_circle:nnnnn
+ { #1, #4 } % line's first point
+ { #3, #2 } % line's second point
+ { #3/2, #4/2 } { #3*#5/2 }
+ {2} % index of intersect
+ }
\draw_path_use_clear:n { stroke }
\draw_scope_end:
}
-% 十字线
-\__circledtext_new_char_box_construct:nn { cross }
+% 外接圆正十字线(需要求交点)
+\__circledtext_new_char_box_construct:nn { __outercross }
{
\draw_scope_begin:
\tl_if_empty:NF \l__circledtext_dash_pattern_tl
@@ -359,8 +460,7 @@
\draw_point_intersect_line_circle:nnnnn
{ #3/2, #2 } % line's first point
{ #3/2, #4 } % line's second point
- { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} }
- { \l__circledtext_char_box_radius_dim }
+ { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 }
{1} % index of intersect
}
\draw_path_lineto:n
@@ -368,8 +468,7 @@
\draw_point_intersect_line_circle:nnnnn
{ #3/2, #2 } % line's first point
{ #3/2, #4 } % line's second point
- { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} }
- { \l__circledtext_char_box_radius_dim }
+ { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 }
{2} % index of intersect
}
\draw_path_moveto:n
@@ -377,8 +476,7 @@
\draw_point_intersect_line_circle:nnnnn
{ #1, #4/2 } % line's first point
{ #3, #4/2 } % line's second point
- { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} }
- { \l__circledtext_char_box_radius_dim }
+ { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 }
{1} % index of intersect
}
\draw_path_lineto:n
@@ -386,110 +484,114 @@
\draw_point_intersect_line_circle:nnnnn
{ #1, #4/2 } % line's first point
{ #3, #4/2 } % line's second point
- { \draw_point_interpolate_line:nnn { 0.5 } { #1, #2} { #3, #4} }
- { \l__circledtext_char_box_radius_dim }
+ { #3/2, #4/2 } { \l__circledtext_char_box_radius_dim*#5 }
{2} % index of intersect
}
\draw_path_use_clear:n { stroke }
\draw_scope_end:
}
-% 对角十字线
-\__circledtext_new_char_box_construct:nn { dcross }
- {
- \draw_scope_begin:
- \tl_if_empty:NF \l__circledtext_dash_pattern_tl
- {
- \exp_args:No \draw_dash_pattern:nn { \l__circledtext_dash_pattern_tl } { 0pt }
- }
- \draw_linewidth:n{ \l__circledtext_cross_linewidth_dim }
- \color_stroke:n { circledtextcrosscolor }
- \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:
- }
-
-% 米字线
-\__circledtext_new_char_box_construct:nn { x+ }
- {
- \__circledtext_char_box_type_c:n { dcross } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { cross } {#1} {#2} {#3} {#4} {#5} {#6}
- }
-
-% 带边框实心圆
+% 填充内切圆叠加内切圆边框
\__circledtext_new_char_box_construct:nn { o }
{
- \__circledtext_char_box_type_c:n { filledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { boxcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innercirclebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
-% 带边框和内十字线实心圆
+% 填充内切圆叠加正方形正十字线与内切圆边框
\__circledtext_new_char_box_construct:nn { o+ }
{
- \__circledtext_char_box_type_c:n { filledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { cross } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { boxcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innercirclebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
-% 带边框和内对角十字线实心圆
+% 填充内切圆叠加内切圆斜十字线与内切圆边框
\__circledtext_new_char_box_construct:nn { ox }
{
- \__circledtext_char_box_type_c:n { filledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { dcross } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { boxcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innerdcross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innercirclebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
-% 带边框和内米字线实心圆
+% 填充内切圆叠加内切圆正斜十字线与内切圆边框
\__circledtext_new_char_box_construct:nn { ox+ }
{
- \__circledtext_char_box_type_c:n { filledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { dcross } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { cross } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { boxcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innerdcross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innercirclebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
-% 带边框实心正方形
-\__circledtext_new_char_box_construct:nn { O }
+% 内切圆斜十字线叠加正十字线
+\__circledtext_new_char_box_construct:nn { x+ }
{
- \__circledtext_char_box_type_c:n { filledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { boxsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innerdcross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6}
}
-% 正方形米字线
-\__circledtext_new_char_box_construct:nn { X+ }
+% 填充正方形叠加正方形边框
+\__circledtext_new_char_box_construct:nn { O }
{
- \__circledtext_char_box_type_c:n { dcrosssquare } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { crosssquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __filledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
-% 带边框和内十字线实心正方形
+% 填充正方形叠加正方形正十字线与正方形边框
\__circledtext_new_char_box_construct:nn { O+ }
{
- \__circledtext_char_box_type_c:n { filledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { crosssquare } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { boxsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __filledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
-% 带边框和内对角十字线实心正方形
+% 填充正方形叠加正方形斜十字线与正方形边框
\__circledtext_new_char_box_construct:nn { OX }
{
- \__circledtext_char_box_type_c:n { filledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { dcrosssquare } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { boxsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __filledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __dcross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
-% 带边框和内米字线实心正方形
+% 填充正方形叠加正方形斜正十字线与正方形边框
\__circledtext_new_char_box_construct:nn { OX+ }
{
- \__circledtext_char_box_type_c:n { filledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { dcrosssquare } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { crosssquare } {#1} {#2} {#3} {#4} {#5} {#6}
- \__circledtext_char_box_type_c:n { boxsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __filledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __dcross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {#5} {#6}
+ }
+
+% 正方形斜十字线叠加正十字线
+\__circledtext_new_char_box_construct:nn { X+ }
+ {
+ \__circledtext_char_box_type_c:n { __dcross } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __scross } {#1} {#2} {#3} {#4} {#5} {#6}
+ }
+
+% 内切圆叠加同心82%内切圆边框
+\__circledtext_new_char_box_construct:nn { oo }
+ {
+ \__circledtext_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innercirclebox } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innercirclebox } {#1} {#2} {#3} {#4} {0.82} {0.82}
+ }
+
+% 反色正方形叠加内切填充圆
+\__circledtext_new_char_box_construct:nn { Oo }
+ {
+ \__circledtext_char_box_type_c:n { __negfilledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __innerfilledcircle } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {#5} {#6}
}
+% 正方形叠加同心82%正方形边框
+\__circledtext_new_char_box_construct:nn { OO }
+ {
+ \__circledtext_char_box_type_c:n { __filledsquare } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {#5} {#6}
+ \__circledtext_char_box_type_c:n { __squarebox } {#1} {#2} {#3} {#4} {0.82} {0.82}
+ }
\msg_new:nnn { circledtext } { box-exists } { The~ box~ type~ `#1~ not~ exists. }
% 缩放类型名称生成函数
@@ -690,6 +792,7 @@
charf .code:n = { \tl_gset:Nn \l__circledtext_character_format_tl {#1}
\__circledtext_calc_char_box_size:
},
+ % charf .initial:n = \normalsize ,
% 边框类型
boxtype .code:n = { \exp_args:NNx \clist_if_in:NnTF
\g__circledtext_char_box_list_clist {#1}
@@ -741,20 +844,26 @@
crosscolorratio .initial:n = 30,
% 字符颜色
- charcolor .code:n = { \__circledtext_color_select:nn { circledtextcharcolor } {#1} } ,
+ charcolor .code:n = { \__circledtext_color_select:nn { circledtextcharcolor } {#1}
+ \tl_if_eq:nnT { #1 } { black }
+ {
+ \__circledtext_color_select:nn { circledtextboxfill }
+ { white }
+ \cs_set_nopar:Npn \__circledtext_aux_color_boxfill:
+ { \color_fill:n { white } }
+ }
+ } ,
charcolor .initial:n = black ,
charcolor* .code:n = { \__circledtext_color_select:nnn { circledtextcharcolor } #1 } ,
color .meta:n = { boxcolor = #1, crosscolor = #1, charcolor = #1 } ,
color* .meta:n = { boxcolor* = #1, crosscolor = #1, charcolor* = #1 } ,
% 字符盒子背景填充颜色
boxfill .code:n = { \exp_args:Nx \tl_if_empty:nTF {#1}
- { \__circledtext_color_select:nn { circledtextboxfill }
- { white }
- \bool_if:NTF \l__circledtext_negative_bool,
- {\cs_set_nopar:Npn \__circledtext_aux_color_boxfill:
- { \color_fill:n { white } }
- }
- {\cs_set_nopar:Npn \__circledtext_aux_color_boxfill: { }}
+ {
+ \__circledtext_color_select:nn { circledtextboxfill }
+ { white }
+ \cs_set_nopar:Npn \__circledtext_aux_color_boxfill:
+ { \color_fill:n { white } }
}{ \__circledtext_color_select:nn { circledtextboxfill } {#1}
\cs_set_nopar:Npn \__circledtext_aux_color_boxfill:
{ \color_fill:n {#1} }
@@ -776,6 +885,10 @@
dashpattern .tl_set:N = \l__circledtext_dash_pattern_tl ,
dashpattern .initial:n = { } ,
+ % 字符自身缩放比例
+ charshrink .fp_set:N = \l__circledtext_char_shrink_fp ,
+ charshrink .initial:n = 0.75,
+
unknown .code:n = { \msg_error:nn { circledtext } { unknown-option } }
}
\msg_new:nnn { circledtext } { unknown-option }
@@ -812,7 +925,9 @@
% 选项设置用户接口
\NewDocumentCommand \circledtextset { m }
- { \keys_set:nn { circledtext } {#1} }
+ {
+ \keys_set:nn { circledtext } {#1}
+ }
% 构建字符盒子,如字符为空,则用基字符构造
% #1 需要处理的字符(串)
@@ -850,21 +965,24 @@
% 复制盒子准备缩放与输出
\coffin_set_eq:NN \l__circledtext_box_coffin \l__circledtext_char_coffin
- % 测量盒子容器总高度
- \dim_set:Nn \l_tmpa_dim
- { \__circledtext_coffin_ht_plus_dp:N \l__circledtext_box_coffin }
- % 缩放字符盒子容器到字符大小
- \coffin_scale:Nnn \l__circledtext_box_coffin
- {
- \dim_ratio:nn { \charboxht } { \l_tmpa_dim }
- }
- {
- \dim_ratio:nn { \charboxht } { \l_tmpa_dim }
- }
+ % % 测量盒子容器总高度(用内切圆则不需要)
+ % \dim_set:Nn \l_tmpa_dim
+ % { \__circledtext_coffin_ht_plus_dp:N \l__circledtext_box_coffin }
+ % % 缩放字符盒子容器到字符大小
+ % \coffin_scale:Nnn \l__circledtext_box_coffin
+ % {
+ % \dim_ratio:nn { \charboxht } { \l_tmpa_dim }
+ % }
+ % {
+ % \dim_ratio:nn { \charboxht } { \l_tmpa_dim }
+ % }
% 根据指定的方式缩放盒子
\__circledtext_resize_c:n { \l__circledtext_resize_method_tl }
+ % 下沉距离=字符深度+外框线宽
+ \dim_add:Nn \l__circledtext_char_dp_dim { \l__circledtext_box_linewidth_dim }
+
% 输出盒子(下沉深度距离)
\coffin_typeset:Nnnnn \l__circledtext_box_coffin
{ l } { b } { 0pt } { -\l__circledtext_char_dp_dim }
@@ -888,17 +1006,12 @@
% 按指定的格式和内容构造一个字符盒子容器
\hcoffin_set:Nn \l__circledtext_box_coffin
{
- % \cs_if_eq:NNTF \__circledtext_aux_color_boxfill: \c_empty_tl
- % {
- % \color_select:n { circledtextcharcolor }
- % }{
- \bool_if:NTF \l__circledtext_negative_bool
- {
- \color_select:n { circledtextboxfill }
- }{
- \color_select:n { circledtextcharcolor }
- }
- % }
+ \bool_if:NTF \l__circledtext_negative_bool
+ {
+ \color_select:n { circledtextboxfill }
+ }{
+ \color_select:n { circledtextcharcolor }
+ }
\tl_use:N \l__circledtext_character_format_tl
\__circledtext_chars_stroke_construct:n { #1 }
}
@@ -929,12 +1042,10 @@
\dim_ratio:nn { \charboxht } { \l_tmpa_dim }
}
- % 如果是矩形外框,则适当缩小文字
- \clist_if_in:nVT {O,O+,OX,OX+,X+} \l__circledtext_char_box_type_tl
- {
- \coffin_scale:Nnn \l__circledtext_box_coffin
- { 0.75 } { 0.75 }
- }
+ % 按指定缩放系数对字符盒子容器进行缩放
+ \coffin_scale:Nnn \l__circledtext_box_coffin
+ { \l__circledtext_char_shrink_fp }
+ { \l__circledtext_char_shrink_fp }
% 绘制外框并拼装结果
\draw_begin: