TeX 字体映射

发布于 2024-08-07 01:57:24 字数 788 浏览 5 评论 0 原文

我正在使用在 XeLaTeX 之上编写的包。这个包使用 fontspec 来指定不同部分的字体您的文本:拉丁语、非拉丁语、数学模式……

该软件包附带了几个示例文件。我能够 xelatex 其中大多数依赖于常规 ttf 或 otf 文件。然而,其中之一尝试将数学模式下的数字字体设置为某种字体,例如“非拉丁数字”。但是,该字体似乎不是常规字体。同一目录中有两个文件,名为“nonlatindigits.map”和“nonlatindigits.tec”。 TECkit 使用这些映射文件来生成 TeX字体。但是,由于某种原因,它无法创建文件,并且 xelatex 发出以下错误消息。

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

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

kpathsea 程序抱怨空格,但删除空格确实解决了加载 TFM 文件的问题。

有什么线索我做错了吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

暮年 2024-08-14 01:57:24

实际的字体文件名是什么?最近在 XeTeX 邮件列表上进行了讨论,涉及一个阻止在 Windows 上加载名称中带有空格的字体文件的错误(在 档案)。如果更改文件名对您有用,那么您可能刚刚遇到了这个错误。

您看到的 kpathsea 调用只是一个副作用:它表明 XeTeX 在 TeX 的默认字体查找系统之上使用的系统库尚未找到该字体,并且 XeTeX 会回退到查找 TFM 文件(最重要的是)。基本文件格式。

TECkit 与字体无关,它会动态转换字符;在你的情况下,我想你可以使用映射将阿拉伯数字转换为印度数字(这样你就不需要直接在源文件中输入后者)。但它不会以任何方式生成字体。

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.

骑趴 2024-08-14 01:57:24

正如其他人提到的,您应该尝试 XeTeX,并且应该确保安装了正确的字体。使用命令 xelatex 代替 pdflatex,以允许在 .tex 文件中使用非拉丁字符。

您没有说明您想要哪种字体编码,但以下两种应该可以很好地工作:Linux Libertine 和 Computer Modern Unicode。 OpenSuSE 软件包名称为 LinuxLibertinecm-unicode;希望其他系统上也有类似的情况。

将以下内容添加为文档中的第一个导入:

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

并在所有其他导入之后添加以下内容(这样它就不会被旧包导入覆盖),

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

或者,如果您想要 Computer Modern 字体,

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

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}
冷︶言冷语的世界 2024-08-14 01:57:24

使用 xetex 或 xelatex 时,要点是您不必指定 tex 字体,您应该使用系统字体。

您应该发布出现错误的部分的代码和序言。就像 html+css 一样,不同的 tex 发行版可以呈现彼此略有不同的内容。

至少,您的序言应如下所示:

 \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}

[Mapping=tex-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.

默嘫て 2024-08-14 01:57:24

Parsi Digits 是您当前没有的字体,您收到的错误是因为您没有该字体。只需将 Parsi Digits' 替换为其他字体即可,一切都会顺利进行。 \setdigitfont 是一个将数字转换为波斯语数学模式的命令,它可以接受Scale' 作为选项。

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 acceptScale' as an option.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文