如何更改graphviz的默认字体大小? [英] how to change default font size for graphviz?
问题描述
我使用doxygen + graphviz记录我的代码。 graphviz在生成图像方面做得很好。
I use doxygen + graphviz for documenting my code. graphviz does a nice job of generating images.
是否可以更改graphviz的默认字体大小?默认值为14,但我想改用12。
Is there any way to change the default fontsize for graphviz? The default is 14, but I want to use 12 instead.
更改单个元素(如节点,子图,边等)的字体大小确实很痛苦。
Its a real pain to change the fontsize for individual elements like, nodes, subgraphs, edges ... etc.
更新:
作为参考,这是我在doxygen中使用的代码,(当然,文本字段已重命名)
For reference here is the code I'm using in doxygen, (the text fields have been renamed, of course)
@dot
strict digraph {
node [shape = box, fontsize = 12];
subgraph cluster_main {
fontsize = 12;
shape = box;
label = "main";
subgraph cluster_main_common {
fontsize = 12;
shape = box;
label = "common";
subgraph cluster_main_common_source {
fontsize = 12;
shape = box;
label = "source"
subgraph cluster_file1 {
fontsize = 12;
shape = box;
label = "file1.c";
gSystem [label = "var1" URL = "\ref var1"];
}
subgraph cluster_file2 {
fontsize = 12;
shape = box;
label = "file2.c";
gCard [label = "var2" URL = "\ref var2"];
}
subgraph cluster_file3 {
fontsize = 12;
shape = box;
label = "file3.c";
gPwrSupply [label = "var3" URL = "\ref var3"];
}
}
}
subgraph cluster_main_docs {
fontsize = 12;
shape = box;
label = "docs";
subgraph cluster_main_docs_features {
fontsize = 12;
shape = box;
label = "features";
subgraph cluster_main_docs_features_source {
fontsize = 12;
shape = box;
label = "source"
subgraph cluster_file4 {
fontsize = 12;
shape = box;
label = "file4.c";
deviceInfo [label = "var4" URL = "\ref var4"];
}
}
}
}
}
}
@enddot
推荐答案
Fontsize是一个图形属性(以及边和节点属性)。 Doxygen会生成一个点文件,因此,例如:
Fontsize is a graph attribute (as well as an edge and node attribute). Doxygen generates a dot file, so, e.g.,:
strict digraph {
graph [ bgcolor=lightgray, resolution=128, fontname=Arial, fontcolor=blue,
fontsize=12 ];
node [ fontname=Arial, fontcolor=blue, fontsize=11];
edge [ fontname=Helvetica, fontcolor=red, fontsize=10 ];
}
特定设置将覆盖通用设置;因此,将fontsize设置为节点属性将覆盖设置为graph属性的fontsize(尽管仅适用于节点),并且将特定节点的fontsize设置将覆盖所有节点的fontsize设置。
Specific settings will override generic ones; hence setting fontsize as a node attribute will override the fontsize set as a graph attribute (just for nodes though), and setting fontsize for specific nodes will override fontsize set for all nodes.
如果尝试上述操作,但似乎不起作用,请更改字体大小,在整个点文件中搜索字体大小设置,将其删除,然后将字体大小重新设置为节点属性。
If you try what i have above and it does not seem to work, change the fontsize, search your entire dot file for 'fontsize' settings, remove them, and re-set fontsize as a node attribute.
以下是完整的graphviz 属性列表。
Here is the complete graphviz attribute list.
这篇关于如何更改graphviz的默认字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!