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?


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.


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}

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.

链接地址: http://www.djcxy.com/p/33410.html

上一篇: 如何为同一字体添加多个字体文件?

下一篇: TeX字体映射