views:

598

answers:

4
+2  Q: 

TeX Font Mapping

I am using a package written on top of XeLaTeX. This package uses fontspec to specify fonts for different parts of your text: latin, non-latin, math mode, ...

The package comes with several sample files. I was able to xelatex most of them that depend on regular ttf or otf files. However, one of them tries to set the font of digits in math mode to some font, say "NonLatin Digits". But, the font doesn't seem to be a regular font. There are two files in the same directory called "nonlatindigits.map" and "nonlatindigits.tec". TECkit uses these mapping files to generate TeX fonts. However, for some reason it fails to create the files, and xelatex issues the following error message.

 kpathsea: Invalid fontname `NonLatin Digits', contains ' '

 ! Font \zf@basefont="NonLatin Digits" at 10.0pt not loadable: Metric (TFM) file or
 installed font not found.

The kpathsea program complains about the whitespace, but removing the whitespace does solve the problem with loading the TFM file.

Any clues what I am doing wrong?

+4  A: 

What's the actual font file name? There have been discussions recently on the XeTeX mailing-list, about a bug that prevented from loading font files with spaces in their names on Windows (look for it in the archives). If changing the file name works for you, you may have just run into this bug.

The kpathsea invocation you see is only a side effect: it indicates that the font hasn't been found by the system libraries that XeTeX uses on top of TeX's default font lookup system, and XeTeX falls back to looking up a TFM file, the most basic file format.

TECkit has nothing to do with fonts, it converts characters on the fly; in your case, I guess you could use a mapping to convert, say, Arabic numbers to Indic numbers (so that you don't need to input the latter in your source file directly). But it does not generate fonts in any way whatsoever.

Arthur Reutenauer
The font I am trying to use is called "Parsi Digits". And, the file I am trying to compile is a sample file provided by the xepersian (http://www.ctan.org/tex-archive/macros/xetex/latex/xepersian/) package. The error occurs when processing the command \setdigitfont[Scale=1]{Parsi Digits}. Removing the space from the fontname doesn't help. The package maintainer refused to answer my question for he judged it as a basic question from a newbie. Therefore, there should be something obvious going wrong.
reprogrammer
OK, that's bad. Where can I download the font from? I could check if there is anything wrong it.
Arthur Reutenauer
The link to the package is provided in my comment above.I have it installed as part of my TeXLive distribution.
reprogrammer
I have the package, too, but not any fonts. Some of them can be downloaded from the links provided in the package's README file, but not all, in particular not Parsi Digits. Where did you download yours from?
Arthur Reutenauer
That's exactly the problem! I don't know where to get that Parsi Digits font from.
reprogrammer
Then why didn't you say that from the beginning! Obviously if you don't have the font XeTeX is not going to be able to use it... All the error messages you see are just a side-effect of that. You should really ask the maintainer where the font is available. Are you really telling me that Vafa refuses to tell you where you can download the font from?
Arthur Reutenauer
He said he doesn't have this font. At this point I guess I should forget about that sample file. It's probably out of date and nobody cares to update the sample file to use some other font. I was just confused about the font mapping files and I thought there is something special in Parsi Digits font that those font mapping files are provided. But, your comments make me believe that Parsi Digits is a regular font and I can replace it by any fonts.Thanks for taking the time to follow up on my question.
reprogrammer
Sadly, this kind of reaction on Vafa's part doesn't surprise me all that much. And yes, Parsi Digits must be a “normal” font; \setdigitfont is defined by xepersian (in xepersian-mathsdigitspec.sty, as it is), but simply leaves the font for fontspec to load, as you yourself wrote. And again, TECkit does nothing to create fonts, it simply maps characters to others in the input; as far as parsidigits is concerned, it maps Arabic digits – I mean 1, 2, 3 – to the corresponding Persian ones – ۱, ۲, ۳ – and does a few other such things as well.
Arthur Reutenauer
A: 

with xetex or xelatex, the poitn is that you don't have to specify tex fonts, you should use your system fonts.

you should post the code and preamble of the parts where you are getting an error. Much like html+css, different tex distros can render things slightly different from one another.

Minimally, your preamble should look something like this:

 \documentclass[12pt,letterpaper]{article}

 \usepackage{fontspec}% provides font selecting commands
 \usepackage{xunicode}% provides unicode character macros
 \usepackage{xltxtra} % provides some fixes/extras

 \setromanfont[Mapping=tex-text]{Font Name}

The [Mapping=tex-text] is particularly important when loading your fonts.

Mica
The file I am trying to compile is a sample file provided by the xepersian (http://www.ctan.org/tex-archive/macros/xetex/latex/xepersian/) package. The preamble of the file is the following: \documentclass{article} \usepackage{xepersian-multiplechoice} \usepackage{xepersian} \settextfont[Scale=1]{XB Zar} \setlatintextfont[Scale=1]{Linux Libertine} \setdigitfont[Scale=1]{Parsi Digits}I get the error at \setdigitfont.
reprogrammer
are you loading fontspec? it probably needs to be loaded before all your persian packages, since the xepersian packages seems to call fontspec.
Mica
you may also want to try and ditch the scale=1.0 command.
Mica
A: 

Parsi Digits is a font that you currently do not have and the error, you are getting is because you do not have the font. Simply replace Parsi Digits' with another font and it all should go fine. \setdigitfont is a command that makes digits in math mode Persian and it can accept Scale' as an option.

Vafa
A: 

As others have mentioned, you should try XeTeX, and you should make sure you have the correct fonts installed. Use the command xelatex in place of pdflatex, to enable use of non-Latin characters in .tex files.

You didn't say which font encoding you want, but the following two should work pretty well: Linux Libertine, and Computer Modern Unicode. The OpenSuSE package names are LinuxLibertine and cm-unicode; hopefully it's similar on other systems.

Add the following as the first imports in your document:

\usepackage{xunicode,fontspec,xltxtra}
\usepackage[english]{polyglossia}
% EXAMPLE: \setotherlanguages{russian} % set as "other" so English hyphenation active

and add the following after all other imports (so it won't be overridden by older package imports),

\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setromanfont{Linux Libertine O}
\setsansfont{Linux Biolinum O}
\setmonofont[Scale=0.9]{Courier New}

or, if you want Computer Modern fonts,

\setromanfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
gatoatigrado