10

I have this example to write text along path using decorations.text library, and I want to insert arabic text starting from right to left

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{fontspec}
\usepackage[rldocument]{bidi}

\setmainfont[Script=Arabic]{Amiri}

\tikzset{decoration={text along path,
text={Very very long text I need to show it from right to left}}} 

\begin{document}

\begin{tikzpicture}
    \path [decorate] (0,0)..controls +(45:4cm) and +(225:4cm)..(8,0); 
\end{tikzpicture}

\end{document}

enter image description here

My hope is to show the text along path from right to left in like manner

left to right from it show to need I text long very Very
Salim Bou
  • 17,021
  • 2
  • 31
  • 76
  • the pgf manual has an entry /pgf/decoration/text effects/reverse text on page 602. It might help. – Denis Jan 17 '18 at 13:24

1 Answers1

9

As it has been mentioned already, the reverse text effect described in the TikZ manual is what you are looking for.

However, you also want to first group the letters using the group letters effect, otherwise it reverses every single letter.

Note that the order of both keys is important, in the example I provide below I wrote both orders to showcase the difference.

EDIT: Forgot to slope the text to follow the path. Using characters={text along path} you make sure that the text is sloped with the path.

\documentclass[border=5mm]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\tikzset{
    decoration={
        text effects along path, 
        text={Very very long text I need to show it from right to left}
    }
} 

\begin{document}

\subsection*{Group letters, reverse text}
\begin{tikzpicture}
    \path [
        decorate, 
        decoration= {
            text effects/.cd, 
                    group letters,
                    reverse text, 
                    characters={text along path}
        }] (0,0)..controls +(45:4cm) and +(225:4cm)..(8,0); 
\end{tikzpicture}

\subsection*{Reverse text, group letters}
\begin{tikzpicture}
    \path [
        decorate, 
        decoration= {
            text effects/.cd, 
                    reverse text, 
                    group letters,
                    characters={text along path}
        }] (0,0)..controls +(45:4cm) and +(225:4cm)..(8,0); 
\end{tikzpicture}

\end{document}

Solution