如何使用GhostScript(gs)打印FontResourceDir?

时间:2013-11-13 15:46:19

标签: ghostscript postscript

我需要我的脚本能够找出Fontmap.GS驻留在给定GhostScript安装中的位置 - 以便可以修改它。

我过去依赖于gs -h的输出,但是版本之间的格式发生了变化 - 并且开始时很笨拙。

我很确定,gs可以被要求整齐地打印它(到stdout),但不幸的是我不知道PostScript。我试过了:

%!
FontResourceDir ==

根本不起作用:Error: /undefined in FontResourceDir。我敢肯定,我非常接近解决方案 - 请帮助。谢谢。

1 个答案:

答案 0 :(得分:2)

您可以使用ghostscript查找其资源文件的位置。 Fontmap.GS似乎位于资源的/Init子目录中。

/Font /Category findresource
begin
    / 128 string ResourceFileName =
  % ^ 
  % | n.b. this is SLASH followed by SPACE. 
  %   We're feeding an "empty" name to ResourceFileName
end

这打印(对我来说):/usr/share/ghostscript/9.06/Resource/Font/

所以,这个管道命令应该可以解决问题(直到它再次改变!)

echo /Font /Category findresource begin / 128 string ResourceFileName = | \
gsnd -q - | \
sed 's/Font\/$/Init\/Fontmap.GS/'
相关问题