红色的希伯来语文本(见下面的代码)没有像我预期的那样从右到左绘制。如何使用 TikZ 为从右到左的希伯来语设置正确的文本方向(围绕一个圆圈)?
\documentclass{article}
\usepackage{tikz}
\usepackage{polyglossia}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary {decorations.text}
\setmainfont[Script=Hebrew]{Cardo}
\setotherlanguage{hebrew}
\begin{document}
\begin{tikzpicture}
\def\mypath{(180:2) -- (240:2) -- (300:2) -- (360:2)}
\tikzset{
mylogo/.style={
regular polygon,
regular polygon sides=6,
minimum size=5cm,
rounded corners,
path picture={
\draw[rounded corners] \mypath;
}
}
}
\foreach \t/\u in {30/-60,90/0,150/60,210/120,270/180,330/240}{
\node[rotate=\u,mylogo](H1) at (\t:4){};
}
\def\mypath{(2.47,3.74)--(2.15,3.74)--(2,4)}
\foreach \t in {0,60,...,300}{
\draw[rotate=\t,rounded corners] \mypath;
}
\path [postaction={
decorate,color=red,
decoration={
raise=-9pt,
text effects along path,
text align=center,
text effects/every character/.style={text along path},
text effects/font = \Large,
text={ץרֶאָֽהָ תאֵ֥וְ םיִמַ֖שָּׁהַ}
% text={הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ} } }] (180:1.7cm) 弧 (180:360:1.7cm); \pathpostaction={装饰,颜色=蓝色,装饰={raise=-7pt,沿路径的文本效果,文本效果/每个字符/.style={沿路径的文本},反向路径=true,文本效果/字体=\large,文本={בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת},文本颜色=蓝色,反向路径,文本对齐/对齐=右,文本效果/反向文本=true } }弧(20:180:2.1cm); \draw[线宽=1pt]圆[半径=1.6]; \foreach \t/\l in { 0/\texthebrew{תּוֹרָה שָׁלֶם}, 60/\texthebrew{בְּרֵאשִׁ֖ית}, 120/\texthebrew{שְׁמוֹת}, 180/\texthebrew{וַיִּקְרָא}, 240/\texthebrew{בְּמִדְבַּר}, 300/\texthebrew{דְּבָרִים} }{ \node[rotate={\t+180*(and(\t>90,\t<270))}] at (\t:3.5){\l}; } \结束{tikzpicture} \结束{文档}
答案1
虽然不是专家,但你似乎以错误的顺序设置了路径。以下方法有效:
\documentclass{article}
\usepackage{tikz}
\usepackage{fontspec}
\usepackage{polyglossia}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary {decorations.text}
\setmainfont[Script=Hebrew]{NewCM10-Book.otf}
\setotherlanguage{hebrew}
\begin{document}
\begin{tikzpicture}
\def\mypath{(180:2) -- (240:2) -- (300:2) -- (360:2)}
\tikzset{
mylogo/.style={
regular polygon,
regular polygon sides=6,
minimum size=5cm,
rounded corners,
path picture={
\draw[rounded corners] \mypath;
}
}
}
\foreach \t/\u in {30/-60,90/0,150/60,210/120,270/180,330/240}{
\node[rotate=\u,mylogo](H1) at (\t:4){};
}
\def\mypath{(2.47,3.74)--(2.15,3.74)--(2,4)}
\foreach \t in {0,60,...,300}{
\draw[rotate=\t,rounded corners] \mypath;
}
\path [postaction={
decorate,color=red,
decoration={
raise=-9pt,
text effects along path,
text align=center,
text effects/every character/.style={text along path},
text effects/font = \Large,
text={הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ}
}
}] (360:2.15cm) arc (360:180:2.15cm);
\path[postaction={
decorate,
color=blue,
decoration={
raise=-7pt,
text effects along path,
text effects/every character/.style={text along path},
reverse path=true,
text effects/font = \large,
text={בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת},
text color=blue,
reverse path,
text align/align=right,
text effects/reverse text=true
}
}](20:2.1cm) arc (20:180:2.1cm);
\draw[line width=1pt] circle[radius=1.6];
\foreach \t/\l in {
0/\texthebrew{תּוֹרָה שָׁלֶם},
60/\texthebrew{בְּרֵאשִׁ֖ית},
120/\texthebrew{שְׁמוֹת},
180/\texthebrew{וַיִּקְרָא},
240/\texthebrew{בְּמִדְבַּר},
300/\texthebrew{דְּבָרִים}
}{
\node[rotate={\t+180*(and(\t>90,\t<270))}] at (\t:3.5){\l};
}
\end{tikzpicture}
\end{document}
注意:我使用了 NewCM 字体,因为我没有您使用过的字体。