本文介绍了Graphviz的可移植性和字体.如何使方案在不同的操作系统上相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac上使用Graphviz,但是我的大多数应用程序都在具有Ubuntu的服务器上运行.我已经注意到,在不同的操作系统上编译时,具有相同源代码的点方案在绘制时会有所不同.

I'm working with Graphviz on Mac but most of my apps run on servers with Ubuntu. I've noticed that dot-schemes with the same source code are drawn a bit differently when compiled on different operating systems.

在我看来,主要原因是系统上字体之间的差异.即使我使用相同的通用字体和相同的大小-它们看起来也太不同了,这对版面有很大影响.

It seems to me that the main reason is the difference between fonts on the systems. Even though I use the same generic fonts and same sizes — they appear too different which affects the layout a lot.

所以问题是:是否可以在整个系统的Graphviz方案中使字体看起来相同?

So the question is: is it possible to make fonts look identical in Graphviz schemes across the systems?

下面我附上演示问题的示例.为了方便起见,图像被附加为链接.

Below I attach the examples demonstrating the problem. Images are attached as links for convenience.

源代码:

digraph {
    graph [label="Mac" labelloc=t]
    dpi=100
    pad=0.2
    rankdir=LR
    a [shape=rect label="width=1" width=1]
    b [shape=rect label="width=1.5 Arial" width=1.5 fontname=Arial]
    c [shape=rect label="width=2.7 Arial 20" width=2.7 fontname=Arial fontsize=20]
    d [shape=rect label="width=4 Helvetica" width=4 fontname=Helvetica]
    e [shape=rect label="width=5 Helvetica 25" width=5 fontname=Helvetica fontsize=25]
    f [shape=rect label="width=6, blue 0.8, red 0.2" width=6 style=filled color="blue:red;0.2" fontcolor=white]
}

09-19 02:52