Graphviz 中的字体质量差

Font's poor quality in Graphviz

我有非常简单的DOTtest.gv文件:

digraph SampleGraph
{
  sampleNode [ label="Whosebug" ];
}

当我用 dot-Tpdf 标志渲染它时,我的像素化字体质量很差。

这是 dot test.gv -Tpdf > test.pdf 的结果:

PostScript 标志 -Tps 工作正常。这是 dot test.gv -Tps > test.ps 的结果:

为什么?


编辑: 我找到了 Graphviz font FAQ 但它没有解释这一点。

连官方documentation也不推荐使用直接-Tpdf转换。

pdf

Produces PDF output. (This option assumes Graphviz includes the Cairo renderer.) Alternatively, one can use the ps2 option to produce PDF-compatible PostScript, and then use a ps-to-pdf converter. Note: At present, this option does not support anchors, etc. To get these included in your PDF output, use ps2.

它不支持一些东西,他们用等等标记它。所以你可以猜到他们不支持的还有什么 -Tpdf

最好将其转换为 ps,然后使用 ghostscript 包中的 ps2pdf 将其转换为 pdf。

ps2pdf myfile.ps myfile.pdf


也看看这个

No freetype. ============

When graphviz is built on systems without freetype, then only the gd renderer will be available for bitmap outputs, and the only available fonts are a small set of builtin bitmap fonts. The poor quality of these fonts will be evident, also, "dot ... -v 2>&1 | grep font" will say that the font is "". This may actually be desirable for installing minimal graphviz programs on a server where fonts may not even be installed.

可能你需要安装 freetype 字体并重建 dot 如果你手动构建它