1

The hebrew text in red (see code below) was not drew in the right-to-left direction as I expected. How to set proper text direction (around a circle) for right-to-left Hebrew language using 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) arc (180:360:1.7cm); \pathpostaction={ 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 } } 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}

1
  • Note that polyglossia automatically loads fontspec, so no need to load the latter separately.
    – Niranjan
    Commented Feb 13 at 4:27

1 Answer 1

0

Not an expert, but you seem to have set the path in the wrong order. The following works:

\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}

1

Note: I used the NewCM font, since I didn't have the one you had used.

2
  • Hi, @Niranjan! As a different approach than my prior post, I replaced "text={הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ}" by "text={ץרֶאָֽהָ תאֵ֥וְ םיִמַ֖שָּׁהַ}"; this orientation suit me nicely, but the diacritics are misaligned. Note that I typed backward each hebrew word, and I guess there is a better way of doing this, instead of typing backward. Does anybody know? Commented Feb 13 at 15:08
  • @NatanaelMartinsNeves I am sure typing things backwards is a bad idea. That's not how Unicode works. Please try correctly typed Hebrew text in the code given in the answer. Unfortunately I don't Hebrew, so I can't really help you in this regard.
    – Niranjan
    Commented Feb 13 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .