35

コードのドキュメント化に doxygen + graphviz を使用しています。graphviz は、画像の生成に優れています。

graphviz のデフォルトのフォントサイズを変更する方法はありますか? デフォルトは 14 ですが、代わりに 12 を使用したいと考えています。

ノード、サブグラフ、エッジなどの個々の要素のフォントサイズを変更するのは本当に面倒です。

アップデート:

参考までに、doxygen で使用しているコードを次に示します (もちろん、テキスト フィールドの名前は変更されています)。

@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
4

1 に答える 1

53

Fontsize はグラフ属性です (エッジおよびノー​​ド属性と同様)。Doxygen はドット ファイルを生成します。たとえば、次のようになります。

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 を設定すると、グラフ アトリビュートとして設定された fontsize が上書きされ (ノードのみ)、特定のノードに fontsize を設定すると、すべてのノードに設定された fontsize が上書きされます。

上記の方法を試してもうまくいかない場合は、フォントサイズを変更し、ドット ファイル全体で「fontsize」設定を検索し、それらを削除して、fontsize をノード属性として再設定します。

これが完全なgraphviz属性リストです。

于 2009-12-25T09:42:36.413 に答える