考虑以下示例,使用字体lhr10
(debian 中的 texlive-lang-cyrillic 包):
\font\myfont=lhr10
\myfont
A
\bye
使用 LuaTeX 进行编译:
$ dviluatex test.tex
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015/Debian) (rev 5238)
restricted \write18 enabled.
(./test.tex
! Font \myfont=lhr10 not loadable: metric data not found or bad.
<to be read again>
\myfont
l.2 \myfont
?
现在用 TeX 编译它:
$ tex test.tex
This is TeX, Version 3.14159265 (TeX Live 2015/Debian) (preloaded format=tex)
(./test.tex
kpathsea: Running mktextfm lhr10
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input lhr10
This is METAFONT, Version 2.7182818 (TeX Live 2015/Debian) (preloaded base=mf)
kpathsea: Running mktexmf lhr10
mf: /usr/local/share/texmf/fonts/source/lh/lh-lcy/lhr10.mf: successfully generated.
(/usr/local/share/texmf/fonts/source/lh/lh-lcy/lhr10.mf
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/fikparm.mf
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/cmbase.mf)
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lcyrbeg.mf)
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lkligtbl.mf)
>> 10
>> "input cmr10" (/usr/share/texlive/texmf-dist/fonts/source/public/cm/cmr10.mf
) (/usr/share/texlive/texmf-dist/fonts/source/lh/lh-lcy/lhcodes.mf)
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lcyrdefs.mf)
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/ldroman.mf
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lxpseudo.mf)
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romanu.mf [65] [66]
[67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81]
[82] [83] [84] [85] [86] [87] [88] [89] [90])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romanl.mf [97] [98]
[99] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109] [110] [111]
[112] [113] [114] [115] [116] [117] [118] [119] [120] [121] [122])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/greeku.mf [0] [1]
[2] [3] [4] [5] [6] [7] [8] [9] [10])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romand.mf [48] [49]
[50] [51] [52] [53] [54] [55] [56] [57])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romanp.mf [36] [38]
[63] [62]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/romspl.mf
[16] [17] [25] [26] [27] [28])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romspu.mf [29] [30]
[31]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/punct.mf [33]
[60] [35] [37] [39] [40] [41] [42] [43] [44] [46] [47] [58] [59] [61] [64]
[91] [93] [96]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/accent.mf
[18] [19] [20] [21] [22] [23] [24] [32] [94] [95] [125] [126] [127])
(/usr/share/texlive/texmf-dist/fonts/source/public/cm/romlig.mf [11] [12]
[13] [14] [15]) (/usr/share/texlive/texmf-dist/fonts/source/public/cm/comlig.mf
[34] [45] [92] [123] [124])
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lgcyru.mf
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lgrusu.mf [128] [129]
[130] [131] [132] [133] [134] [135] [136] [137] [138] [139] [140] [141]
[142] [143] [144] [145] [146] [147] [148] [149] [150] [151] [152] [153]
[154] [155] [156] [157] [158] [159] [240])
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lgt2comu.mf [246] [248]
[242] [250] [244]))
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lgcyrl.mf
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lgrusl.mf [160] [161]
[162] [163] [164] [165] [166] [167] [168] [169] [170] [171] [172] [173]
[174] [175] [224] [225] [226] [227] [228] [229] [230] [231] [232] [233]
[234] [235] [236] [237] [238] [239] [241])
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lgt2coml.mf [247] [243]
[249] [251] [245]))
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lgcyrsym.mf [196] [252]
[197] [255] [253] [254])
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/lgcyracc.mf)
(/usr/share/texlive/texmf-dist/fonts/source/lh/base/llvligtb.mf)
(/usr/share/texlive/texmf-dist/fonts/source/lh/lh-lcy/lhliker.mf) ) ) )
(some charht values had to be adjusted by as much as 0.07101pt)
Font metrics written on lhr10.tfm.
Output written on lhr10.600gf (210 characters, 41768 bytes).
Transcript written on lhr10.log.
mktextfm: /usr/local/share/texmf/fonts/tfm/lh/lh-lcy/lhr10.tfm: successfully generated.
[1] )
Output written on test.dvi (1 page, 252 bytes).
Transcript written on test.log.
为什么LuaTeX没有自动生成这种字体?
编辑
如果我们在 tex 生成字体后运行 dviluatex,则不会出现问题。如果我们在 pdf 模式下运行 luatex字体由 tex 生成后(如果我们之前没有用 tex 生成字体,它会给出相同的“未找到度量数据或错误”错误),它给出这个错误:
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015/Debian) (rev 5238)
(./test.tex [1{/usr/local/share/texmf/fonts/map/pdftex/updmap/pdftex.map}]){/usr
/share/texmf/fonts/enc/dvips/lm/lm-rm.enc}
kpathsea: Running mktexpk --mfmode / --bdpi 72 --mag 1+0/72 --dpi 72 lhr10
mktexpk: Mismatched mode ljfour and resolution 72; ignoring mode.
mktexpk: Can't guess mode for 72 dpi devices.
mktexpk: Use a config file or option to specify the mode; see:
mktexpk: http://tug.org/texinfohtml/kpathsea.html#Unable-to-generate-fonts
kpathsea: Appending font creation commands to missfont.log.
!LuaTeX error (file lhr10): Font lhr10 at 72 not found
==> Fatal error occurred, no output PDF file produced!
如果我们指定\pdfpkresolution=600
,它就可以正常工作:
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015/Debian) (rev 5238)
(./test.tex [1{/usr/local/share/texmf/fonts/map/pdftex/updmap/pdftex.map}]){/usr
/share/texmf/fonts/enc/dvips/lm/lm-rm.enc}<</usr/local/share/texmf/fonts/pk/ljfo
ur/lh/lh-lcy/lhr10.600pk>><</usr/share/texmf/fonts/type1/public/lm/lmr10.pfb>
Output written on test.pdf (1 page, 18095 bytes).
Transcript written on test.log.
答案1
对于 aleph 和 lua(jit) tex 以外的引擎,
kpse_set_program_enabled (kpse_tfm_format, MAKE_TEX_TFM_BY_DEFAULT,
kpse_src_compile);
最初被调用。然而,在 lua(jit)tex 的情况下,它不会被调用。因此你必须运行
mktextfm lhr10
如果您想使用不存在的 tfm 文件 lhr10.tfm,请手动操作。