![在 Ubuntu 20.04 上使用自动安装 TexLive 安装 ttf 字体时字体形状未定义](https://linux22.com/image/430673/%E5%9C%A8%20Ubuntu%2020.04%20%E4%B8%8A%E4%BD%BF%E7%94%A8%E8%87%AA%E5%8A%A8%E5%AE%89%E8%A3%85%20TexLive%20%E5%AE%89%E8%A3%85%20ttf%20%E5%AD%97%E4%BD%93%E6%97%B6%E5%AD%97%E4%BD%93%E5%BD%A2%E7%8A%B6%E6%9C%AA%E5%AE%9A%E4%B9%89.png)
我正在尝试在 Ubuntu 20.04 上通过 autoinst 将 TrueType 字体与 Texlive (3.14159265-2.6-1.40.20 (TeX Live 2019/Debian)) 结合使用。即使 autoinst 正确创建了所有文件和形状,我仍然无法使不同的字体形状正常工作并出现以下错误。
LaTeX Font Warning: Font shape `T1/OpenSans/m/it' undefined
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
为了说明这个问题,我使用了 Open Sans(可在此处获得:https://fonts.google.com/specimen/Open+Sans?preview.text_type=custom)当我跑步时
sudo autoinst *.ttf
在下载文件夹中,autoinst 按预期运行。日志文件如下所示:
[2021-03-19 17:16:28] /usr/bin/autoinst, version 20200129
"/usr/bin/autoinst OpenSans-Bold.ttf OpenSans-ExtraBold.ttf OpenSans-LightItalic.ttf OpenSans-SemiBoldItalic.ttf OpenSans-BoldItalic.ttf OpenSans-ExtraBoldItalic.ttf OpenSans-Italic.ttf OpenSans-Light.ttf OpenSans-Regular.ttf OpenSans-SemiBold.ttf"
----------------------------------------------------------------------------
I'm using the following options:
encoding(s): OT1, LY1, T1
NFSS: sf (sanserif)
lining: yes
oldstyle: yes
proportional: yes
tabular: yes
ts1: yes
smallcaps: yes
swash: yes
titling: yes
superiors: yes
inferiors: none
ornaments: yes
fractions: no
ligatures: yes
auto/manual: auto
target: /home/ird/Downloads/OpenSans/autoinst_output
extra:
figurekern: keep
mergewidths: yes
mergeweights: yes
mergeshapes: yes
nfssweight:
nfsswidth:
----------------------------------------------------------------------------
NFSS mappings:
ul =>
el =>
l => light
sl =>
m => regular
sb => semibold
b => bold
eb => extrabold
ub =>
uc =>
ec =>
c =>
sc =>
m => regular
sx =>
x =>
ex =>
ux =>
将创建的文件夹复制到我的工作texmf-dist文件夹并运行sudo texhash和 sudo updmap-sys我可以在以下文件上运行 pdflatex
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{OpenSans}
\begin{document}
This is supposed to be Open Sans, but is Computer Modern.
I can change the font manually by {\fontfamily{OpenSans}\selectfont to be OpenSans.}
But I can make it {\fontfamily{OpenSans}\fontshape{it}\selectfont to be italic.}
\end{document}
我得到的错误是
LaTeX Font Warning: Font shape `T1/OpenSans/m/n' undefined
(Font) using `T1/cmr/m/n' instead on input line 11.
LaTeX Font Warning: Font shape `T1/OpenSans/m/it' undefined
(Font) using `T1/OpenSans/m/n' instead on input line 13.
(/usr/share/texlive/texmf-dist/tex/latex/bera/t1fvs.fd) (/usr/share/texlive/texmf-dist/tex/latex/psnfss/t1pbk.fd) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./General_Notes.aux)
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
有什么提示吗?我做错了什么?似乎OpenSans.sty文件不起作用,但 Latex 没有抱怨或抛出任何其他错误。
非常感谢!
答案1
感谢 Ulrike 的回复。实际上,在此过程中并没有创建 T1openssans.fd,但创建了名为 T1OpenSans-LF.fd 或类似名称的文件,这些文件位于 /usr/share/texlive/texmf-dist/tex/latex/OpenSans/T1OpenSans-OsF.fd
T1OpenSans-LF.fd 的内容如下所示:
%% Generated by autoinst on 2021/03/20
%%
\ProvidesFile{T1OpenSans-LF.fd}
[2021/03/20 (autoinst) Font definitions for T1/OpenSans-LF.]
\expandafter\ifx\csname OpenSans@scale\endcsname\relax
\let\OpenSans@@scale\@empty
\else
\edef\OpenSans@@scale{s*[\csname OpenSans@scale\endcsname]}%
\fi
\DeclareFontFamily{T1}{OpenSans-LF}{}
\DeclareFontShape{T1}{OpenSans-LF}{l}{n}{
<-> \OpenSans@@scale OpenSans-Light-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{l}{it}{
<-> \OpenSans@@scale OpenSans-LightItalic-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{l}{sl}{
<-> ssub * OpenSans-LF/l/it
}{}
\DeclareFontShape{T1}{OpenSans-LF}{eb}{n}{
<-> \OpenSans@@scale OpenSans-ExtraBold-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{eb}{it}{
<-> \OpenSans@@scale OpenSans-ExtraBoldItalic-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{eb}{sl}{
<-> ssub * OpenSans-LF/eb/it
}{}
\DeclareFontShape{T1}{OpenSans-LF}{sb}{it}{
<-> \OpenSans@@scale OpenSans-SemiBoldItalic-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{sb}{n}{
<-> \OpenSans@@scale OpenSans-SemiBold-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{sb}{sl}{
<-> ssub * OpenSans-LF/sb/it
}{}
\DeclareFontShape{T1}{OpenSans-LF}{m}{n}{
<-> \OpenSans@@scale OpenSans-Regular-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{m}{it}{
<-> \OpenSans@@scale OpenSans-Italic-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{m}{sl}{
<-> ssub * OpenSans-LF/m/it
}{}
\DeclareFontShape{T1}{OpenSans-LF}{b}{n}{
<-> \OpenSans@@scale OpenSans-Bold-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{b}{it}{
<-> \OpenSans@@scale OpenSans-BoldItalic-lf-t1
}{}
\DeclareFontShape{T1}{OpenSans-LF}{b}{sl}{
<-> ssub * OpenSans-LF/b/it
}{}
\DeclareFontShape{T1}{OpenSans-LF}{bx}{sl}{
<-> ssub * OpenSans-LF/b/sl
}{}
\DeclareFontShape{T1}{OpenSans-LF}{bx}{n}{
<-> ssub * OpenSans-LF/b/n
}{}
\DeclareFontShape{T1}{OpenSans-LF}{bx}{it}{
<-> ssub * OpenSans-LF/b/it
}{}
\endinput