直線ベースラインを円形に組版する

直線ベースラインを円形に組版する

円形の配置をどのように設定すればよいのか疑問に思いましたここ図「(2)」では、中心点から放射状に伸びる一連の直線として表されています。

テキストの円形配置

これまで私が見つけた最も便利なものは文字を回転する(多かれ少なかれ完全なチュートリアル) はパッケージにあります。とコマンドgraphicxの非常に困難な組み合わせで実行できると確信していますが、よりエレガントな解決策を知っている人がいるのではないかと期待しています。graphicxhspacevspace

(円形のベースラインを持つ他のタイプについて質問するつもりでしたが、円形パスに沿ってテキストの回転を微調整するにはどうすればいいですか?かなり広範囲にわたってその点が明らかになりそうです。

アップデート:感謝しますウィブロウほぼ目的を達成し、ヘブライ文字でそれを実行するという余分な努力をしてくれてありがとう。追加のアイデアを提案したい人がいたら、以降の例ではローマ字で十分だということを知らせたかっただけです。

答え1

右から左に記述する言語の場合、装飾はそれほど多用途ではありませんが、次の方法で実行できます。 を使用したコンパイルが必要ですlualatex。 の方が、おそらくPSTricksよりよい方法でしょう。

また、私が使用しているフォントはfreesans、お使いのシステムで使用できるかどうかはわかりません。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{fontspec}
\newfontfamily\hebrewfont[Script=Hebrew]{freesans}

\tikzset{
    decorate path with hebrew/.style={
        decoration={
            text along path,
            text={|\luatextextdir TRT\hebrewfont|#1},
        },
        decorate,
    },
    hebrew text/.style={
        font=\hebrewfont, 
        execute at begin node={\luatextextdir TRT}
    }
}

\begin{document}

\begin{tikzpicture}
\path [decorate path with hebrew={מלון אבוקדו מישמש תפוח אבוקדו אבטיח אשכולית גזר}]
    circle [radius=1.25cm];
\foreach \w [count=\i from 0] in {מלון,אבוקדו,מישמש,תפוח,אבוקדו,אבטיח,אשכולית,גזר}
    \node [hebrew text, anchor=west,shift=(\i*45:1.25cm), rotate=\i*45] {\w};

\end{tikzpicture}

\end{document}

ここに画像の説明を入力してください

内側のベースラインを取得するには、reverse pathキーをデコレーションと一緒に使用できます。このキーをうまく使用できるかどうかは、円のパスが内部でどのように描画されるか (つまり、時計回り) によって決まることに注意してください。円が 4 つの円弧を使用して手動で反時計回りに描画される場合、reverse pathキーは不要になります (もちろん、デコレーション エンジンの作成者が十分に賢い場合は、パスの方向を自動的に決定する方法を考え出すでしょう ;-)

文字を積み重ねる唯一の方法は、単語の各文字を大まかに反復処理することであり、マクロを使用してこれを行いました\stacklettersalignキーしなければならないスタッキングを機能させるには、オプションで使用できます。回転\nodeの変更にも注意してください。anchor

反対方向(つまり、内側)に積み重ねるには、anchorを に変更しsouth、 を使用しますrotate=\i*45-90。これは、スタイルに結び付けられる可能性があります。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\usepackage{fontspec}
\newfontfamily\hebrewfont[Script=Hebrew]{freesans}

\tikzset{
    decorate path with hebrew outside/.style={
        postaction={
            decoration={
                text along path,
                text={|\luatextextdir TRT\hebrewfont|#1},
                reverse path, % Make decoration go the other way
            },
            decorate
        }
    },
    hebrew text/.style={
        font=\hebrewfont, 
        execute at begin node={\luatextextdir TRT}
    }
}

\def\stackletters#1{\let\flag=\relax\expandafter\dostackletters#1;}
\def\dostackletters#1{%
    \ifx#1;%
    \else%      
        \ifx\flag\relax%
            #1%
            \let\flag=\stackletters%
        \else%
            \\[-0.25\baselineskip]#1%
        \fi%
        \expandafter\dostackletters%
    \fi}


\begin{document}

\begin{tikzpicture}
\path [decorate path with hebrew outside={מלון אבוקדו מישמש תפוח אבוקדו אבטיח אשכולית גזר}]
    circle [radius=1cm];
\foreach \w [count=\i from 0] in {מלון,אבוקדו,מישמש,תפוח,אבוקדו,אבטיח,אשכולית,גזר}
    \node [hebrew text, align=center, anchor=north, shift=(\i*45:1.25cm), rotate=\i*45+90] {\stackletters{\w}};

\end{tikzpicture}


\end{document}

ここに画像の説明を入力してください

したがって、要求に応じて、 を必要としないローマ字付きバージョンですlualatex。ノードの内容をスタックするためのコードが少し変更されました。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\tikzset{
    decorate path with text outside/.style={
        postaction={
            decoration={
                text along path,
                text={#1},
                reverse path, % Make decoration go the other way
            },
            decorate
        }
    },
}


\def\stacknodecontents#1\ignorespaces{%
    % #1 contains a whole load of internal TikZ code
    % which terminates with an \ignorespaces
    % (just before the node text begins)
    #1\ignorespaces%
    \let\stacknext=\relax%
    % \expandafter in case the node text is a macro.
    \expandafter\dostacknodecontentslet}

\def\dostacknodecontentslet{%
    \afterassignment\dostacknodecontentstypeset%
    % Need global.
    \global\let\stacktoken=}

\def\dostacknodecontentstypeset{%
    \ifx\stacktoken\egroup% <- the } at the end of the node.
        \let\stacknext=\stacktoken%
    \else%
        % If \stacknext is \relax then \stacktoken is the first
        % token, and does not require a new line.
        \ifx\stacknext\dostacknodecontentslet%
            \\[-0.25\baselineskip]% Should parameterise this.
        \fi%
        \stacktoken%
        \let\stacknext=\dostacknodecontentslet%
    \fi%
    \stacknext}

\tikzset{
    stack node text/.style={
        align=center,
        execute at begin node=\stacknodecontents%
    }
}


\begin{document}


\begin{tikzpicture}
\path [decorate path with text outside={apple banana celary date egg fig grape honey}]
    circle [radius=1.1212cm];
\foreach \w [count=\i from 0] in {apple, banana, celary, date, egg, fig, grape, honey}
    \node [stack node text, anchor=north, shift=(\i*45:1.3636cm), rotate=\i*45+90] {\w};

\end{tikzpicture}


\end{document}

ここに画像の説明を入力してください

関連情報