我正在尝试创建如下所示的 TikZ 图形,但是当添加一些阿拉伯文本时,编译会出现问题。
\documentclass[tikz, border=5pt, multi]{standalone}
\usepackage{polyglossia}
\usepackage [utf] {arabxetex}
\usepackage{fontspec}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{fourier}
\setmainlanguage[variant=british]{english}
\newfontfamily\arabicfont{Amiri}[Script=Arabic]
\usetikzlibrary{arrows.meta,calc}
\usepackage{color}
\usepackage{tikz,pgfornament,tikzrput} % altermundus.com/pages/tkz/tikzrput/
\usetikzlibrary{decorations,decorations.text} % altermundus.com/pages/tkz/ornament/
\begin{document}
\begin{tikzpicture}
\node[circle, minimum size=7cm, draw, fill=yellow] (a) {};
\node[circle, minimum size=6cm, draw, fill=green] (b) {};
\draw [decorate, decoration={text along path, text =\textarabic{المنزل العربي الكبير يحب الخير} }]
(150:3.1) arc (150:30:3.1cm);
%\draw [decorate, decoration={text along path, text =XXXXX YYYYY XXXXX}]
%(150:3.1) arc (150:30:3.1cm);
\end{tikzpicture}
\end{document}
答案1
由于阿拉伯语比较复杂,字符连接起来形成一个单词,与英语和拉丁语不同,它不能轻易地弯曲以遵循路径。为了解决这个问题,您必须使用 将文本拆分为单独的单词,并通过在 开头添加text format delimiters={|}{|}
来激活字体。tikzpicture
\arabicfont\fontsize{12pt}{20}\selectfont
\documentclass[tikz, border=5pt, multi]{standalone}
\usepackage{polyglossia}
\usepackage [utf] {arabxetex}
\usepackage{fontspec}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{fourier}
\setmainlanguage[variant=british]{english}
\newfontfamily\arabicfont{Amiri}[Script=Arabic]
\usetikzlibrary{arrows.meta,calc}
\usepackage{color}
\usepackage{tikz,pgfornament,tikzrput} % altermundus.com/pages/tkz/tikzrput/
\usetikzlibrary{decorations,decorations.text} % altermundus.com/pages/tkz/ornament/
\begin{document}
\begin{tikzpicture}\arabicfont\fontsize{12pt}{20}\selectfont
\node[circle, minimum size=7cm, draw, fill=yellow] (a) {};
\node[circle, minimum size=6cm, draw, fill=green] (b) {};
\draw [decorate, decoration={text along path,text format delimiters={|}{|},text={|\textarabic|{الخير} |\textarabic|{يحب} |\textarabic|{الكبير} |\textarabic|{العربي} |\textarabic|{الوطن}},raise=1.5pt}]
(150:3.1) arc (150:30:3.1cm);
%\draw [decorate, decoration={text along path, text =XXXXX YYYYY XXXXX}]
%(150:3.1) arc (150:30:3.1cm);
\end{tikzpicture}
\end{document}