在 ConTeXt 中使用窄字体

在 ConTeXt 中使用窄字体

我阅读了一些关于字体的资料:

https://wiki.contextgarden.net/ConTeXt_distribution%27s_Fonts
https://wiki.contextgarden.net/Font_Switching
https://wiki.contextgarden.net/Command/setupbodyfont

根据https://wiki.contextgarden.net/Latin_Modern我能够使用\definedfont[ec-lmtlc10]切换到 Latin Modern Light Condensed,但我无法让 Helvetica Narrow 工作,尽管它已安装在我的系统上:

❯ mtxrun --script fonts --list --all --pattern='*helvetica*'
[...]
fonts           | names | accessing the data table failed
identifier                   familyname   fontname                     filename       subfont   instances

helvetica                    helvetica    helvetica                    phvr8a.afm
helveticabold                helvetica    helveticabold                phvb8a.afm
helveticaboldoblique         helvetica    helveticaboldoblique         phvbo8a.afm
helveticamedium              helvetica    helvetica                    phvr8a.afm
helveticanarrow              helvetica    helveticanarrow              phvr8an.afm
helveticanarrowbold          helvetica    helveticanarrowbold          phvb8an.afm
helveticanarrowboldoblique   helvetica    helveticanarrowboldoblique   phvbo8an.afm
helveticanarrowoblique       helvetica    helveticanarrowoblique       phvro8an.afm
helveticaoblique             helvetica    helveticaoblique             phvro8a.afm

但是当我尝试通过加载它时\definedfont[name:helveticanarrow*default at 12 pt]出现以下错误:

fonts           > afm loading > reading '/usr/share/texmf-dist/fonts/afm/adobe/helvetic/phvr8an.afm'
fonts           > afm loading > no pfb file for '/usr/share/texmf-dist/fonts/afm/adobe/helvetic/phvr8an.afm'
fonts           > afm loading > reading '/usr/share/texmf-dist/fonts/afm/adobe/helvetic/phvr8an.afm'
fonts           > afm loading > no pfb file for '/usr/share/texmf-dist/fonts/afm/adobe/helvetic/phvr8an.afm'
fonts           > defining > forced type 'afm' of 'phvr8an' not found
fonts           > defining > font with asked name 'phvr8an' is not found using lookup 'name'
fonts           > defining > unknown font 'phvr8an', loading aborted
fonts           > defining > unable to define 'helveticanarrow' as 'thedefinedfont--0'

答案1

您的系统有“metrics”文件(.afm),但没有字体本身(.pfb)。您可以下载该文件NimbusSansNarrow-Bold.t1并将其重命名为phvr8an.pfb,但您应该使用默认安装的 TeX Gyre Heros Condensed,它相当于 Helvetica Narrow:

\starttext
\definedfont[name:texgyreheroscn-regular*default at 12 pt]
Hello!
\stoptext

在此处输入图片描述

默认安装中的完整 Heros (Helvetica) 系列:

mtxrun --script fonts --list --all --pattern='*heros*'
identifier                        familyname       fontname                          filename                        subfont   instances

texgyreherosbold                  texgyreheros     texgyreherosbold                  texgyreheros-bold.otf
texgyreherosbolditalic            texgyreheros     texgyreherosbolditalic            texgyreheros-bolditalic.otf
texgyreheroscnbold                texgyreheroscn   texgyreheroscondensedbold         texgyreheroscn-bold.otf
texgyreheroscnbolditalic          texgyreheroscn   texgyreheroscondensedbolditalic   texgyreheroscn-bolditalic.otf
texgyreheroscnitalic              texgyreheroscn   texgyreheroscondenseditalic       texgyreheroscn-italic.otf
texgyreheroscnnormal              texgyreheroscn   texgyreheroscondenseditalic       texgyreheroscn-italic.otf
texgyreheroscnregular             texgyreheroscn   texgyreheroscondensedregular      texgyreheroscn-regular.otf
texgyreheroscondensedbold         texgyreheroscn   texgyreheroscondensedbold         texgyreheroscn-bold.otf
texgyreheroscondensedbolditalic   texgyreheroscn   texgyreheroscondensedbolditalic   texgyreheroscn-bolditalic.otf
texgyreheroscondenseditalic       texgyreheroscn   texgyreheroscondenseditalic       texgyreheroscn-italic.otf
texgyreheroscondensedregular      texgyreheroscn   texgyreheroscondensedregular      texgyreheroscn-regular.otf
texgyreherositalic                texgyreheros     texgyreherositalic                texgyreheros-italic.otf
texgyreherosnormal                texgyreheros     texgyreherositalic                texgyreheros-italic.otf
texgyreherosregular               texgyreheros     texgyreherosregular               texgyreheros-regular.otf

相关内容