# Italic a Persian word in Xelatex using overleaf

I'm trying to write a word in italic in Xelatex using overleaf. But \textit doesn't work for persian words unless I upload a font. When I do so I can only upload .ttf files and by uploading the italic font all the text is written in italic.

What should I do?

\settextfont[Scale=1.0]{XB Yas.ttf}
\begin{document}
\textit{سلام}
\end{document}

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – dexteritas Jan 10 at 9:29

You need to tell fontspec where to find the italic font:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{XB Yas.ttf}[
BoldFont       = XB YasBd.ttf ,
ItalicFont     = XB YasIt.ttf ,
BoldItalicFont = XB YasBdIt.ttf]

\begin{document}
Hello! \textit{سلام}
\end{document}