介绍

介绍

我得到了一个 .zip 文件,里面有一些字体文件 - 它们看起来像这样:

  • 韓國
  • 響鳴響

我将这两个文件放入一个文件夹中~/texmf/fonts/type1/sckr,然后运行命令:

sudo texhash ~/texmf
sudo updmap-sys --enable Map=fontname.map
sudo texhash ~/texmf

但是当我尝试将字体包含在我的文档中时,它看起来像这样:

\documentclass[a4paper,10pt]{article}

\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{sckr}


\begin{document}
\thispagestyle{empty}

    {\sckr primer}

\end{document}

我收到一条错误消息,提示sckr.sty未找到。有人能帮我解决这个问题吗?


添加:所以我只从供应商那里获得了.pfb文件.pfm,但在 Lehman 的教程中说我还需要.afm文件。

在此处输入图片描述

现在我将文件复制到一个目录中并将它们重命名为sckr.pfbsckr.pfm我只注意名称短于 8 个字符,就像 Berry 编写的 fontname.pdf 中所建议的那样)并且没有理会其他重命名约定。

然后我将这个名为 fontinst 的文件添加pfb-drv.tex到同一个文件夹中:

\input fontinst.sty
\recordtransforms{psb-rec.tex}
    \latinfamily{psb}{}
\endrecordtransforms
\bye

我使用命令运行它

tex psb-drv.tex

我得到了很多错误:

[ziga@Ziga-laptop sckr (normal)]$ tex psb-drv.tex 
This is TeX, Version 3.14159265 (TeX Live 2014/Arch Linux) (preloaded format=tex)
(./psb-drv.tex (/usr/share/texmf-dist/tex/fontinst/base/fontinst.sty
No file fontinst.rc.
)
INFO> parse family <psb><>
INFO> to make LaTeX font shape <psb,m,n,> seek psbr8r.mtx
INFO> to make LaTeX font shape <psb,m,sc,> seek psbrc8r.mtx
INFO> to make LaTeX font shape <psb,m,sl,> seek psbro8r.mtx
INFO> to make LaTeX font shape <psb,m,it,> seek psbri8r.mtx
INFO> to make LaTeX font shape <psb,m,n,c> seek psbr8rn.mtx
INFO> to make LaTeX font shape <psb,m,sc,c> seek psbrc8rn.mtx
INFO> to make LaTeX font shape <psb,m,sl,c> seek psbro8rn.mtx
INFO> to make LaTeX font shape <psb,m,it,c> seek psbri8rn.mtx
INFO> to make LaTeX font shape <psb,m,n,> seek psbk8r.mtx
INFO> to make LaTeX font shape <psb,m,sc,> seek psbkc8r.mtx
INFO> to make LaTeX font shape <psb,m,sl,> seek psbko8r.mtx
INFO> to make LaTeX font shape <psb,m,it,> seek psbki8r.mtx
INFO> to make LaTeX font shape <psb,m,n,c> seek psbk8rn.mtx
INFO> to make LaTeX font shape <psb,m,sc,c> seek psbkc8rn.mtx
INFO> to make LaTeX font shape <psb,m,sl,c> seek psbko8rn.mtx
INFO> to make LaTeX font shape <psb,m,it,c> seek psbki8rn.mtx
INFO> to make LaTeX font shape <psb,b,n,> seek psbb8r.mtx
INFO> to make LaTeX font shape <psb,b,sc,> seek psbbc8r.mtx
INFO> to make LaTeX font shape <psb,b,sl,> seek psbbo8r.mtx
INFO> to make LaTeX font shape <psb,b,it,> seek psbbi8r.mtx
INFO> to make LaTeX font shape <psb,b,n,c> seek psbb8rn.mtx
INFO> to make LaTeX font shape <psb,b,sc,c> seek psbbc8rn.mtx
INFO> to make LaTeX font shape <psb,b,sl,c> seek psbbo8rn.mtx
INFO> to make LaTeX font shape <psb,b,it,c> seek psbbi8rn.mtx
INFO> to make LaTeX font shape <psb,sb,n,> seek psbs8r.mtx
INFO> to make LaTeX font shape <psb,sb,sc,> seek psbsc8r.mtx
INFO> to make LaTeX font shape <psb,sb,sl,> seek psbso8r.mtx
INFO> to make LaTeX font shape <psb,sb,it,> seek psbsi8r.mtx
INFO> to make LaTeX font shape <psb,sb,n,c> seek psbs8rn.mtx
INFO> to make LaTeX font shape <psb,sb,sc,c> seek psbsc8rn.mtx
INFO> to make LaTeX font shape <psb,sb,sl,c> seek psbso8rn.mtx
INFO> to make LaTeX font shape <psb,sb,it,c> seek psbsi8rn.mtx
INFO> to make LaTeX font shape <psb,db,n,> seek psbd8r.mtx
INFO> to make LaTeX font shape <psb,db,sc,> seek psbdc8r.mtx
INFO> to make LaTeX font shape <psb,db,sl,> seek psbdo8r.mtx
INFO> to make LaTeX font shape <psb,db,it,> seek psbdi8r.mtx
INFO> to make LaTeX font shape <psb,db,n,c> seek psbd8rn.mtx
INFO> to make LaTeX font shape <psb,db,sc,c> seek psbdc8rn.mtx
INFO> to make LaTeX font shape <psb,db,sl,c> seek psbdo8rn.mtx
INFO> to make LaTeX font shape <psb,db,it,c> seek psbdi8rn.mtx
INFO> to make LaTeX font shape <psb,mb,n,> seek psbm8r.mtx
INFO> to make LaTeX font shape <psb,mb,sc,> seek psbmc8r.mtx
INFO> to make LaTeX font shape <psb,mb,sl,> seek psbmo8r.mtx
INFO> to make LaTeX font shape <psb,mb,it,> seek psbmi8r.mtx
INFO> to make LaTeX font shape <psb,mb,n,c> seek psbm8rn.mtx
INFO> to make LaTeX font shape <psb,mb,sc,c> seek psbmc8rn.mtx
INFO> to make LaTeX font shape <psb,mb,sl,c> seek psbmo8rn.mtx
INFO> to make LaTeX font shape <psb,mb,it,c> seek psbmi8rn.mtx
INFO> to make LaTeX font shape <psb,eb,n,> seek psbc8r.mtx
INFO> to make LaTeX font shape <psb,eb,sc,> seek psbcc8r.mtx
INFO> to make LaTeX font shape <psb,eb,sl,> seek psbco8r.mtx
INFO> to make LaTeX font shape <psb,eb,it,> seek psbci8r.mtx
INFO> to make LaTeX font shape <psb,eb,n,c> seek psbc8rn.mtx
INFO> to make LaTeX font shape <psb,eb,sc,c> seek psbcc8rn.mtx
INFO> to make LaTeX font shape <psb,eb,sl,c> seek psbco8rn.mtx
INFO> to make LaTeX font shape <psb,eb,it,c> seek psbci8rn.mtx
INFO> to make LaTeX font shape <psb,eb,n,> seek psbh8r.mtx
INFO> to make LaTeX font shape <psb,eb,sc,> seek psbhc8r.mtx
INFO> to make LaTeX font shape <psb,eb,sl,> seek psbho8r.mtx
INFO> to make LaTeX font shape <psb,eb,it,> seek psbhi8r.mtx
INFO> to make LaTeX font shape <psb,eb,n,c> seek psbh8rn.mtx
INFO> to make LaTeX font shape <psb,eb,sc,c> seek psbhc8rn.mtx
INFO> to make LaTeX font shape <psb,eb,sl,c> seek psbho8rn.mtx
INFO> to make LaTeX font shape <psb,eb,it,c> seek psbhi8rn.mtx
INFO> to make LaTeX font shape <psb,eb,n,> seek psbx8r.mtx
INFO> to make LaTeX font shape <psb,eb,sc,> seek psbxc8r.mtx
INFO> to make LaTeX font shape <psb,eb,sl,> seek psbxo8r.mtx
INFO> to make LaTeX font shape <psb,eb,it,> seek psbxi8r.mtx
INFO> to make LaTeX font shape <psb,eb,n,c> seek psbx8rn.mtx
INFO> to make LaTeX font shape <psb,eb,sc,c> seek psbxc8rn.mtx
INFO> to make LaTeX font shape <psb,eb,sl,c> seek psbxo8rn.mtx
INFO> to make LaTeX font shape <psb,eb,it,c> seek psbxi8rn.mtx
INFO> to make LaTeX font shape <psb,ub,n,> seek psbu8r.mtx
INFO> to make LaTeX font shape <psb,ub,sc,> seek psbuc8r.mtx
INFO> to make LaTeX font shape <psb,ub,sl,> seek psbuo8r.mtx
INFO> to make LaTeX font shape <psb,ub,it,> seek psbui8r.mtx
INFO> to make LaTeX font shape <psb,ub,n,c> seek psbu8rn.mtx
INFO> to make LaTeX font shape <psb,ub,sc,c> seek psbuc8rn.mtx
INFO> to make LaTeX font shape <psb,ub,sl,c> seek psbuo8rn.mtx
INFO> to make LaTeX font shape <psb,ub,it,c> seek psbui8rn.mtx
INFO> to make LaTeX font shape <psb,l,n,> seek psbl8r.mtx
INFO> to make LaTeX font shape <psb,l,sc,> seek psblc8r.mtx
INFO> to make LaTeX font shape <psb,l,sl,> seek psblo8r.mtx
INFO> to make LaTeX font shape <psb,l,it,> seek psbli8r.mtx
INFO> to make LaTeX font shape <psb,l,n,c> seek psbl8rn.mtx
INFO> to make LaTeX font shape <psb,l,sc,c> seek psblc8rn.mtx
INFO> to make LaTeX font shape <psb,l,sl,c> seek psblo8rn.mtx
INFO> to make LaTeX font shape <psb,l,it,c> seek psbli8rn.mtx
Font definitions written on 8rpsb.fd.
Font definitions written on ot1psb.fd.
Font definitions written on t1psb.fd.
Font definitions written on ts1psb.fd.
Font transformation records written on psb-rec.tex.
 )
No pages of output.
Transcript written on psb-drv.log.

我确信我写错了...

答案1

我要开始记录这件事,以备后人之需,如果后人感兴趣的话。这对我来说很管用(正如聊天中所讨论的),但 OP 仍然遇到了一些fontinst初期问题。

本答案假设使用类似 Unix 的系统,例如 GNU/Linux、OS X、BSD 或类似系统。未经修改,它将无法在 Windows 上运行。

介绍

要在 (pdf)(La)TeX 中使用字体,除了 type1 字体本身之外,您还需要大量的支持文件。

此答案基于fontinst《字体安装指南》中第一个教程中介绍的初始基本安装方法。在大多数情况下,该方法虽然不完全完美,但可以正常工作。在其他情况下,该方法可能会失败,或者根据字体的性质,该方法可能会产生尽可能完美的结果。

对于该问题所涉及的字体,它应该产生一个有效的结果。

准备字体支持包

首先重命名.pfm sckr.pfm.pfb sckr.pfb

然后

pf2afm sckr
mv sckr.afm sckr8a.afm
mv sckr.pfb sckr8a.pfb 

然后OP创建了一个文件sck-drv.tex

\input fontinst.sty
\needsfontinstversion{1.926}
\recordtransforms{sck-rec.tex}
\latinfamily{sck}{}
\endrecordtransforms
\bye

另一个sck-map.tex

\input finstmsc.sty
\resetstr{PSfontsuffix}{.pfb}
\adddriver{dvips}{sck.map}
\adddriver{pltotf}{sck-pltotf.sh}
\input sck-rec.tex
\donedrivers
\bye

然后:

tex sck-drv.tex

生成sck-rec.tex和一堆.fd.pl.vpl文件。这些.pl文件将转换为.tfm

for i in *.pl
do
pltotf $i
done

以及.vpl.vf

for i in *.vpl
do
vptovf $i
done

然后

tex sck-map.tex

生成一个可以使用以下命令运行的sck.map脚本:sck-pltotf.shsh

sh sck-pltotf.sh

您现在可以删除*.pl *.vpl sck-rec.tex sck-pltotf.sh等等,因为它们不再需要。

然后你可以制作一个包sck.sty

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{DAX}[2015/09/06 v1.0 DAX]

\DeclareOption{default}{%
        \renewcommand{\sfdefault}{sck}}
\ProcessOptions
\DeclareRobustCommand{\sckfamily}{%
        \fontseries{m}%
        \fontshape{n}%
        \fontfamily{sck}%
        \selectfont}
\DeclareTextFontCommand{\sck}{\sckfamily}
\endinput

测试

此时你可以说

\documentclass{article}
\pdfmapfile{+sck.map}
\usepckage[T1]{fontenc}% optional
\usepackage{sck}

\begin{document}
\sck{Some text}

{\sckfamily More text including off, office, affluent, fluorine, infinitude, --- and --

\slshape This is fake, oblique. 
The results will not be as good as a designed italic or oblique shape.

\upshape\scshape You may also get faked small-caps.
Again, the results won't be as good as real small-caps.

\upshape\itshape Italics should give us the oblique as a substitute.

\par}    
\end{document}

并且当您latexpdflatex测试文件时它应该可以工作,前提是您的测试文件与您创建的所有字体文件位于同一目录中。

如果您对结果不满意,请不要继续安装。

安装

当您对测试结果满意时,您可以安装字体文件。

原因我解释一下这里,除非您别无选择,否则不建议将其安装到您的个人 TEXMF 树中。

相反,安装到系统范围的本地 TEXMF 树中。你可以使用以下命令找出它的位置kpsewhich

kpsewhich -var TEXMFLOCAL

如果你正在使用上游的 TeX Live 并且没有更改texmf.cnf,那么这可能会返回一个目录。例如,我得到

/usr/local/texlive/texmf-local

所以这是我要使用的目录。如果您使用的是 TeX Live 的打包版本(例如来自 GNU/Linux 发行版),那么您可能会获得多个目录。例如,在 Arch Linux 上,您将获得

/usr/local/share/texmf:/usr/share/texmf

感谢楼主提供的信息。在这种情况下,你应该选择不是由 Linux 发行版的包管理器管理。在大多数情况下,它将以 开头/usr/local。因此,在 Arch Linux 上,您可以使用

/usr/local/share/texmf

在本答案的其余部分,我将选定的目录称为<TEXMFLOCAL>。如果kpsewhich返回的结果只有一个,则可以替换$(kpsewhich -var TEXMFLOCAL)。否则,请适当替换相关的目录路径。

其余步骤可能需要以 root 权限完成,具体取决于您的系统配置。

很可能您需要在这里创建一些目录。这是正常的。

mkdir -p <TEXMFLOCAL>/fonts/type1/public/sck
mkdir -p <TEXMFLOCAL>/fonts/tfm/public/sck
mkdir -p <TEXMFLOCAL>/fonts/afm/public/sck
mkdir -p <TEXMFLOCAL>/fonts/vf/public/sck
mkdir -p <TEXMFLOCAL>/fonts/map/dvips/sck
mkdir -p <TEXMFLOCAL>/tex/latex/sck
mkdir -p <TEXMFLOCAL>/source/fonts/sck

您可以使用sck目录名称以外的其他名称 - 只需适当替换即可。

现在,从您准备字体文件的工作目录中:

mv *.pfb *.pfm <TEXMFLOCAL>/fonts/type1/public/sck/
mv *.tfm <TEXMFLOCAL>/fonts/tfm/public/sck/
mv *.afm <TEXMFLOCAL>/fonts/afm/public/sck/
mv *.vf <TEXMFLOCAL>/fonts/vf/public/sck/
mv *.map <TEXMFLOCAL>/fonts/map/dvips/sck/
mv *.fd *.sty <TEXMFLOCAL>/tex/latex/sck/
mv sck-drv.tex sck-map.tex <name of test file>.tex <notes> <TEXMFLOCAL>/source/fonts/sck/

放入东西source是可选的,仅供参考。我发现它很有用,这样我就可以找到东西。

现在,您需要更新文件名数据库:

mktexlsr <TEXMFLOCAL>

有两种方法可以启用.map文件碎片。第一种方法有一定的优势,但我不确定它如何与 Arch 的软件包配合使用,所以我建议使用第二种:

updmap-sys --enable Map=sck.map

重新测试

现在您应该能够放弃任何 root 权限并从另一个目录重新编译您的测试文档,注释掉或删除该\pdfmapfile...行,以获得相同的结果。

相关内容