5

I'm trying to add persian text to my document but it doesn't accept the fonts I set and returns this error:

The font "XB Niloofar" cannot be found.

I just installed texlive using this guid. And this is the document I'm trying to compile:

\documentclass[12pt,a4paper,twoside]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{xepersian}
\settextfont[Scale=1, Mapping=arabic]{XB Niloofar}
\begin{document}
سلام!
\end{document}

Should I install these fonts or the problem is something else? Thank you

7

Yes. You should install the font in your OS, or use the font as an external file.

If you installed the font file (e.g. using Windows control panel/font), then you can call your font using

\settextfont{XB Niloofar}

no mapping is needed, since xepersian sets the proper mapping by default.

If you want to use your font, without installing it, your font file must be accessible by your engine, i.e. either in your working directory, or a in proper place in texmf. Use ExternalLocation parameter for this situation:

\settextfont[ExternalLocation]{xbniloofar.ttf}

or whatever the filename is.

Please, by the way, make sure that you always load xepersian as the last package.

3

Just an answer for Linux users which will find this page via search engines:

If you use a Linux distro such as Ubuntu then download the font from the open font library and copy it to ~/.fonts direcotry and run the following command to add it to the fonts cache:

$ fc-cache -v ~/.fonts

Then recompile your document.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.